A calm assistant face with ten fluid expressions and agent session states.
Idle
Appearance
Agent state
Configuration
import { BotFace } from "@/components/ui/bot-face"
<BotFace
shape="squircle"
color="violet"
eyes="slant"
state="idle"
size="lg"
/>Installation#
bunx --bun fabricator-ui@latest add bot-face
Usage#
import { BotFace } from "@/components/ui/bot-face"<BotFace shape="squircle" color="violet" aria-label="Fabricator assistant" />BotFace belongs in an assistant avatar, an empty conversation or a voice interface. It is a decorative image by default. Give it aria-label when it conveys identity; put it inside a named Button if it performs an action.
Agent states#
state changes the expression while keeping the selected silhouette, colour and size. The selected eye style shapes ordinary expressions and waveform caps; thinking, questioning and error morph the eyes into their own symbols. The ten states are idle, listening, thinking, working, speaking, happy, sad, questioning, awaiting-permission and error.
<BotFace state="working" color="violet" aria-label="Assistant working" />
<BotFace state="awaiting-permission" aria-label="Waiting for permission" />Use questioning when the assistant needs an answer and awaiting-permission when a manual approval is pending. speaking means audio playback; text generation uses working. sad is an explicit emotion, separate from a failed run. Denying a request or stopping a task does not make the assistant sad.
Connect an agent session#
The optional hook maps a normalized snapshot into a stable expression. It holds through brief busy/idle gaps, shows questions, permissions and failures immediately, and acknowledges successful completion once. The component has no agent SDK dependency.
import {
useBotFaceState,
type BotFaceSessionSnapshot,
} from "@/hooks/use-bot-face-state"
function AssistantStatus({ snapshot }: { snapshot: BotFaceSessionSnapshot }) {
const state = useBotFaceState(snapshot)
return <BotFace state={state} aria-label={`Assistant ${state}`} />
}Type snapshot as BotFaceSessionSnapshot, exported from the hook:
| Field | Values or meaning |
|---|---|
sessionId | Conversation identity; changing it clears old presentation holds |
runId | Current run identity |
revision | Monotonically increasing across runs within the conversation |
lifecycle | idle, running, paused, cancelled, failed, succeeded |
activity | idle, thinking, working, listening, speaking |
pendingPermissions | Number of unresolved requests requiring manual approval |
pendingQuestions | Number of unresolved questions requiring an answer |
Terminal outcomes clear obsolete blockers. During a run, permissions take priority over questions, which take priority over activity. Only explicit successful run completion produces a brief happy expression. Lower revisions are ignored, and duplicate completion updates do not replay it. Assign revisions at the session boundary and discard events belonging to older runs there.
With the AI SDK, map submitted to thinking and streaming to working unless actual microphone/playback activity is present. Count current tool parts in approval-requested only when part.approval.isAutomatic is false or absent. Do not count historical tool parts, automatically resolved approvals or already answered requests. Transport ready does not prove a successful run; use the application's explicit lifecycle outcome. The adapter keeps transport I/O and external validation in the application.
The hook returns a visual state. Keep status text, permission controls and live announcements tied to actual session facts so presentation holds never delay an actionable request.
Shapes and colours#
The main playground groups shape, colour and eyes on the left, with states on the right. Both groups control the same face and stack on a phone. Switching a state retains the selected appearance. Choose from eleven named colours, including gray, or open Custom to use the Color Picker. The configuration block follows the current options and copies the matching component code. Theme roles remain available through the component’s color prop.
The fourteen shapes are circle, blob, square, star, clover, heart, flower, droplet, pill, triangle, pentagon, burst, hexagon and squircle.
The theme roles primary, secondary, info, success, warning and destructive follow the project's look. neutral uses the foreground. The fixed gray palette colour uses a medium gray in each theme. Named hues blue, indigo, violet, pink, red, orange, amber, green and teal use Fabricator's primary colour presets, including their light and dark fills and contrasting eyes. Use status roles when the face communicates a status.
Custom colours#
color also accepts CSS hex strings with #: three, four, six or eight digits, including alpha. The eyes choose black or white from the RGB fill for contrast. Transparency is preserved; its final contrast depends on the surface behind the face.
<BotFace color="#6b97ff" shape="hexagon" state="thinking" />
<BotFace color="#abc" eyes="dots" />
<BotFace color="#6b97ffcc" />Sizes#
sm, default and lg are 40, 80 and 120 respectively. For an avatar that must fit another size, set width and height through style.
Eyes#
slant gives the reference's two rounded, slanted eyes. dots and square offer quieter alternatives.
Motion#
The body keeps its layout position and size. Gaze moves within 6% of the face dimension. Body turns stay within 6 degrees, with small head nods (up to 14 degrees of pitch) and side turns (up to 12 degrees of yaw). These rotations change the projected silhouette without translating or scaling the component. Idle follows the pointer on web/desktop or a touch on native; active states direct their own attention. Explicit gaze takes priority. It does not request device sensor access.
| State | Eye and body gesture |
|---|---|
idle | Quiet glances and periodic blinks |
listening | Two agreement nods. The eyes lead and the head follows |
thinking | Held upper-corner glances with staggered eye lifts and focused squints |
working | Focused eye scans with a coordinated side-to-side turn of the shape |
speaking | Six independently animated sound-wave bars |
happy | Rising smile arcs with a gentle tilt back |
sad | Downcast lids and a slow head droop |
questioning | An eye with a lid curl that grows, eases, and lets one eye lead |
awaiting-permission | Paired eye raises and a small expectant head lift |
error | Crossed eyes with a slow settling lean |
All states use the same two persistent SVG paths. Questioning keeps the eye body and bends a short curl from the upper corner. The curl eases between a softer eye and a clearer question, and one eye leads the other. Thinking uses the selected eye shape, holding an upward glance before a quicker shift to the opposite corner. A staggered lift and squint gives the eyes a quiet processing rhythm. Thinking and questioning blink naturally. Waveform and crossed eyes stay open while the blink clock continues in the background.
A gesture starts when its state is entered and continues through repeated session updates. Inside a state the shape holds, then moves, with one eye ahead of the other. State changes morph the visible eye outlines, matching perimeter points and preserving each point’s position and velocity. The eyes settle first and the head follows. Wave bars split from and merge into the eye edges. The eyes keep their SVG nodes and blink clock, including when a transition is interrupted; no neutral reset is inserted. Motion pauses offscreen on web and while the app is inactive on native. Fabricator move/settle timings follow the region’s speed setting.
followPointer={false} keeps idle motion and blinking while disabling pointer/touch tracking. blink={false} keeps the eyes open. gaze={{ x: 0.6, y: -0.2 }} controls the direction, with both axes normalized to -1…1 and clamped to an ellipse. animated={false}, Reduce Motion and the Fabricator motion-off or instant setting show a still version of the selected expression, with centred gaze, a level body and no blinking. Static expressions remain readable.
<BotFace color="info" shape="pill" eyes="dots" blink={false} />
<BotFace color="primary" gaze={{ x: 0.6, y: -0.2 }} />
<BotFace shape="flower" color="success" animated={false} />API Reference#
| Prop | Type | Default |
|---|---|---|
shape | BotFaceShape | "squircle" |
color | BotFaceColor | "primary" |
eyes | "slant" | "dots" | "square" | "slant" |
size | "sm" | "default" | "lg" | "default" |
state | BotFaceState | "idle" |
animated | boolean | true |
blink | boolean | true |
followPointer | boolean | true |
gaze | { x: number; y: number } | Idle or pointer/touch direction |
Web renders a span; native renders a View. Both accept their platform's element props and ref, and export BotFaceProps, BotFaceShape, BotFaceColor, BotFaceEyes, BotFaceSize BotFaceGaze and BotFaceState.
Data attributes#
data-slot values are bot-face, bot-face-body, bot-face-shape, bot-face-gaze bot-face-eyes and bot-face-eye. The root exposes data-shape, data-color, data-eyes, data-size data-state and data-animated.
Accessibility#
BotFace is decorative by default. If adjacent text already identifies the assistant and its state, keep the face hidden from assistive technology. A standalone identity can use aria-label; it is an image, not an interactive control. If it performs an action, wrap it in a named Button.
Use visible text to communicate session status and real controls to answer questions or approve actions. A separate polite live region can announce meaningful changes once. Never announce blinks or animation frames. Reduced motion retains the selected static expression.