Thinking State
The wait before the first word: what it is doing, for how long, and the trail so far.
- Category
- AI Chat
- Access
- Free with an account
- Source
- 231 lines · one file
- States
- 3 drawn
When to use it
Use Thinking State for the wait before an answer starts: a label, the step the model is on, a timer, and a trail of steps that folds to "Thought for 5s · 3 steps" when done. AI Chat shows it on its own; use this when you build the thread yourself.
Installation
How you get it
Paste this into Claude Code, Cursor, Codex or any coding agent. It installs the file and uses it as it is, instead of writing a new one.
Use Liro's Thinking State for this.
Install it: npx shadcn@latest add @liro/thinking-state
(the @liro registry is set up in components.json, with LIRO_KEY in .env.local)
Import it from @/components/ui/thinking-state.
Do not rewrite or restyle it. Pass my data through its props
and keep its built-in states.For the full brief with every prop and the mistakes assistants usually make, use Copy prompt above. Free components install through the @liro registry with your CLI token: see the Namespaced tab.
Usage
import { ThinkingState } from "@/components/ui/thinking-state";
export function Thinking({ done }: { done: boolean }) {
return (
<ThinkingState
label="Searching your files"
steps={[
{ label: "Reading invoices.csv", status: "done" },
{ label: "Matching payments", status: done ? "done" : "active" },
]}
done={done}
/>
);
}API reference
“Copy prompt” above puts a full brief on your clipboard, install command, dependencies, props, and the mistakes an assistant usually makes with this component.
Props
Read from the component’s own TypeScript interface when the site is built, so this table cannot drift from the file you install.
| Type | Notes | ||
|---|---|---|---|
label | string | No | One word for what is happening. Default "Thinking". |
detail | string | No | What it is doing right now. Changes are crossfaded. |
steps | ThinkingStep[] | No | The trail so far. With steps, the row becomes a button that unfolds them. |
done | boolean | No | Finished. Stops the motion and reads "Thought for 6s". |
seconds | number | No | Seconds taken. Counted from mount when left out. |
variant | "shimmer" | "dots" | "pulse" | No | `shimmer` sweeps the label, `dots` bounce beside it, `pulse` breathes the mark. Default `shimmer`. |
defaultOpen | boolean | No | Whether the steps start unfolded. Default false. |
open | boolean | No | – |
onOpenChange | (open: boolean) => void | No | – |
Dependencies
npm packages
clsxframer-motionlucide-reacttailwind-mergeLiro foundations, installed alongside it
liro-themeStates
All of them are drawn by the component. None is left for you to design.
- Thinking
- With steps
- Done
Accessibility
- Keyboard reachable throughout, in visual order
- Focus trapped in overlays, Escape closes them
- Focus returns to whatever opened it
- Live regions announce what changed, not that something did
- Honours prefers-reduced-motion
Responsive behavior
- Sizes to its container, not the viewport
- Usable from 320px up
- Pointer-based interaction, so trackpad and touch both work
- No hover-only affordances