shadcn.io is an independent project built on shadcn/ui
On this page12 sections
Persona is an animated avatar that shows what an assistant is doing right now. It breathes while idle, draws ripples in while listening, churns while thinking, pulses with a voice while speaking and dims when asleep. Put it in a voice chat, at the top of a chat panel or beside the assistant's replies, and set its state from your chat.
When the wait has no assistant behind it, such as a form saving, a Spinner says loading with less.
Installation
Besides the component file, the install writes Persona's CSS into your stylesheet: two keyframes, five registered custom properties and a utility class for each layer of the drawing. There is no animation library, canvas or file to download behind it.
Anatomy

Usage
import { Persona } from "@/components/ui/persona";<Persona className="size-16" state="thinking" variant="opal" />Accessibility
Persona is one element with the img role, named after its state, such as "Assistant is thinking", and every layer of the drawing inside it is hidden from assistive tech. The name is English and uses the state's own word, so pass aria-label to give it your assistant's name or the page's language. A label you pass stays the same in every state. A screen reader doesn't announce a new name on an image, so when the change matters, write the state into a polite live region beside it, as the Voice chat demo does.
Demos
Variants
All six looks side by side, each in the state that the buttons underneath set, starting at idle. obsidian, halo, glint and command are drawn in your foreground color, so they turn light on a dark page, while mana and opal take your primary color. Pick one look for an assistant and keep it, and let the state do the changing.
States
One look in all five states at once, starting with command, the terminal key, with a select above to switch to another look. Compare how each variant tells listening from thinking before you settle on one. A change of state eases over 0.7 seconds, or 1.4 seconds into sleep, so setting it on every step of your chat never makes it jump.
Sizes
The mana drop, listening, at five sizes from size-8 to size-32. Persona fills its box, so a size class is all it needs. Below 56 pixels the body takes 86% of the box instead of 72%, leaving less room for the ripples, so a small one beside a message still reads as a shape.
Voice chat
One voice turn, simulated on a card. Press the mic and the opal listens while the question appears word by word, then it thinks for a moment and speaks as the answer arrives, and the moon button puts it to sleep. A polite live region under it says each state in words for screen readers. In your app, a recorder such as Speech Input takes the mic's place.
Theming
Every color comes from your theme's tokens. obsidian, halo, glint and command draw with --foreground and shade with --background. mana and opal mix --primary with the background and the foreground, and take two neighboring hues from it with relative color syntax, 40 and 80 degrees around the color wheel.
To give one persona an accent of its own, add a class that sets --primary on it, such as [--primary:var(--color-sky-500)]. Only mana and opal change, since the other four never read the primary. A gray primary leaves those two without a hue, in shades of gray.
AI SDK
Set state from the chat's status. submitted is the wait between sending a message and the first token, and streaming is the reply arriving.
const { status } = useChat();
const state: PersonaState =
status === "submitted"
? "thinking"
: status === "streaming"
? "speaking"
: "idle";
return <Persona className="size-16" state={state} variant="opal" />;In a voice chat the status isn't enough on its own: listening covers the time the microphone records, thinking the transcription and the reply being generated, and speaking the time the reply's audio plays.
Migrating from AI SDK Elements
If you added Persona from AI SDK Elements (opens in a new tab), your project has a components/ai-elements/persona.tsx that plays Rive files. Install this one and import Persona from your ui folder instead: state and variant take the same values, and the six variants keep their names. What differs:
- There is no Rive. The
@rive-app/react-webgl2package and the.rivfiles it downloads are no longer needed, and the persona draws on the first paint. onReadyis called once, when the persona mounts.onLoad,onLoadError,onPlay,onPauseandonStopare gone, because they reported on the Rive file and its playback.stateis optional and defaults toidle.- Changing
variantneeds nokeyto remount, and a change ofstateeases instead of cutting. manaandopalfollow your theme's primary color instead of fixed colors.
FAQ
Which Persona state should I show, and when?
Show idle while the assistant waits for input, listening while the person talks or the microphone records, and thinking from sending the request to the first token. Switch to speaking while the reply streams in or its audio plays, and to asleep when the session is paused or closed.
Set state every time your chat changes. Each change eases from the last one, so a quick run of changes reads as one movement.
How do I change the colors of a Persona?
Change your theme, or --primary on one persona. obsidian, halo, glint and command are drawn in --foreground, so they are dark on a light page and light on a dark one, and they follow any change to it.
mana and opal take --primary and two hues next to it. Add a class that sets --primary on a single persona to give that one assistant its own color, as the Theming section shows.
Does Persona respect prefers-reduced-motion?
It does. With reduced motion turned on, the clock that drives every layer stops, and each state holds a still pose of its own, so the states still look different from one another. The ripples stand as rings while listening, the sparks or the cursor's cells hold their places while thinking, and asleep is smaller and dimmer.
A change of state switches poses at once instead of easing, since the transition time drops to zero.
How do screen readers announce a Persona state change?
They don't announce it on their own. Persona is an image named for its state, such as "Assistant is thinking", and a screen reader reads that name only when someone reaches the image. A new name on an image isn't announced.
When the change matters, write the state into a polite live region next to it, as the Voice chat demo does with its status line. Pass aria-label to give the image your assistant's name instead of the default.
How do I change the size of a Persona?
Give it a size class: it fills its box, which is size-16 unless you set another. size-8 fits beside a message, size-16 heads a chat panel, and size-24 to size-32 lead a voice chat.
Below 56 pixels the body fills 86% of the box instead of 72%, so the shape stays clear at avatar sizes. The Sizes demo shows five of them side by side.
Why is my Persona not animating?
Check the system's reduced motion setting first: while it's on, Persona holds a still pose for each state on purpose. If the drawing is missing or flat, every layer is styled by the CSS the install wrote into your stylesheet, so make sure that file is the one your app loads.
The motion runs on registered custom properties. A browser without @property support can't animate them, so the drawing holds still and a change of state cuts instead of easing.
Does an animated Persona slow down the page?
It runs no JavaScript per frame. A 24-second CSS loop moves one registered property that every layer computes its motion from, and the three listening rings have a keyframe animation of their own.
An animated custom property is worked out on the main thread, so the browser restyles each persona on screen every frame. One scrolled out of view isn't drawn, because its scene has content-visibility set to auto. In a long chat history, show a still avatar beside old replies and keep Persona for the live turn.
How is this Persona different from the AI SDK Elements Persona?
The states and the six variant names are the same, and there is no Rive. AI SDK Elements plays a Rive file for each variant. This one draws each in CSS from your theme, so it shows on the first paint and needs no runtime or download.
The Rive callbacks are gone, and onReady fires once on mount. The Migrating section lists each difference.
API Reference
Persona
<div> data-slot="persona"
onReady?() → void
Called once, when the persona is on the page. AI SDK Elements calls it when its Rive file has loaded; this one has nothing to load.
- Returns
void
state?PersonaState
What the assistant is doing: idle breathes, listening draws
ripples in, thinking churns, speaking pulses like a voice, and
asleep dims and slows. A change eases from one to the next.
- Default
"idle"
variant?PersonaVariant
The look. obsidian (a cut stone), halo (a ring of light), glint
(a sparkle) and command (a terminal key) are drawn in the theme's
foreground; mana (a drop of fluid) and opal (a glass orb) in its
primary.
- Default
"obsidian"
className?string
Merged with the part's classes.
data-state?string
Mirrors state.
data-variant?string
Mirrors variant.
--persona-inkstring
The colour the ripples and glow are drawn in (the foreground; the primary for mana and opal).











