An agent's face: a shape and a color with eyes that move with what it's doing.
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { PersonaAvatar, personaColors, personaShapes } from "./ui/uicontext/components/kit/Persona.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ grid: { display: "grid", gridTemplateColumns: "repeat(8, 32px)", gap: space.md, justifyContent: "center" },})export const ShapesAndColors = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.grid)).children( personaColors.flatMap((color) => personaShapes.map((shape) => PersonaAvatar(h, { persona: { shape, color }, size: "md" }).key(`${color}-${shape}`))), )Installation
pnpm dlx shadcn@latest add checkfu/uicontext/personaUsage
import { PersonaAvatar } from "./ui/uicontext/components/kit/Persona.ts"export const InboxFace = <M>(h: Html.H<M>, working: boolean) => PersonaAvatar(h, { persona: { shape: "drop", color: "blue" }, size: "md", state: working ? "working" : "idle" })Examples
What it's doing
Idle blinks, thinking glances, working bobs, waiting shows an amber dot, blocked a red one. Under reduced motion the faces hold still and the dots stay.
Idle
Thinking
Working
Needs you
Blocked
Done
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { PersonaAvatar, type PersonaState } from "./ui/uicontext/components/kit/Persona.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { color, font, space } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ row: { display: "flex", flexWrap: "wrap", justifyContent: "center", gap: space.xl }, cell: { display: "flex", flexDirection: "column", alignItems: "center", gap: space.sm, color: color.muted, fontSize: font.sm },})const states: ReadonlyArray<readonly [PersonaState, string]> = [ ["idle", "Idle"], ["thinking", "Thinking"], ["working", "Working"], ["waiting", "Needs you"], ["blocked", "Blocked"], ["done", "Done"],]export const States = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.row)).children(states.map(([state, label]) => h.div.key(state).attrs(sx(styles.cell)).children(PersonaAvatar(h, { persona: { shape: "circle", color: "purple" }, size: "lg", state }), label)))Sizes
16 and 20 for trees and headers, 32 for lists, 44 for a phone's pinned row, 96 for a new agent's preview.
import type { Html } from "@effect/ui/html"import * as stylex from "@stylexjs/stylex"import { PersonaAvatar } from "./ui/uicontext/components/kit/Persona.ts"import { sx } from "./ui/uicontext/components/Sx.ts"import { space } from "./ui/uicontext/components/tokens.stylex.ts"const styles = stylex.create({ row: { display: "flex", alignItems: "flex-end", justifyContent: "center", gap: space.xl } })export const Sizes = <M>(h: Html.H<M>) => h.div.attrs(sx(styles.row)).children((["xs", "sm", "md", "lg", "xl"] as const).map((size) => PersonaAvatar(h, { persona: { shape: "cloud", color: "green" }, size }).key(size)))API reference
Options
| Name | Type | Default | Description |
|---|---|---|---|
personarequired | Persona | — | — |
size | "xs" | "sm" | "md" | "lg" | "xl" | — | 16, 20, 32, 44 or 96 pixels; md (32) by default |
state | "idle" | "thinking" | "working" | "waiting" | "blocked" | "done" | idle | What it's doing, shown as motion and a dot; idle by default |
label | string | — | A name for screen readers; decorative (hidden) when the agent's name sits beside it |
style | Style | — | — |