What an agent is doing before it answers: live steps as they stream in, the sources it searched and read, tool calls, its reasoning, and a quiet “Thought for 12s” once it is done.
On this page
- Show agent thinking
- List sources searched
- Stream reasoning text
- Summarise thinking time
- Header above an answer
Examples
Installation
npx knowns-ui@latest add thinking-statePaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Thinking state from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/thinking-state
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add thinking-state
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/use-floating.ts
- components/ui/knowns/tooltip.tsx
- components/ui/knowns/tooltip-utils.ts
- components/ui/knowns/badge.tsx
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- components/ui/knowns/illustrations/illust-utils.ts
- components/ui/knowns/illustrations/use-in-view.ts
- components/ui/knowns/text-animation/text-core.tsx
- components/ui/knowns/text-animation/shimmer-text.tsx
- components/ui/knowns/thinking-state/thinking-indicator.tsx
- components/ui/knowns/thinking-state/thinking-state.tsx
- components/ui/knowns/thinking-state/thinking-utils.ts
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/thinking-state, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "thinking-state" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- steps
ThinkingStep[]- Your live steps, in order. Append and update them as events stream in. New steps rise in; the last one without a status follows the run.
- status
"thinking"|"done"|"stopped"|"failed"- Default
"thinking" - The run. Thinking opens the panel with a shimmering label and a live timer; done folds it to “Thought for 12s”.
- startedAt / endedAt
number|Date- Run timing (ms or Date). Without them, and without elapsed, the component times the run itself.
- elapsed
number- Seconds spent, if you track it. Wins over startedAt / endedAt.
- reasoning
string- Streaming reasoning, muted under the steps. Shows the newest lines while live, with Show more / Show less.
- reasoningLines
number- Default
3 - Lines shown before Show more.
- label
string- Default
"Thinking…" - Header text while running when no step is running.
- endedLabel
(status, seconds) => ReactNode- Default
“Thought for 12s” - Header text once the run ended (also “Stopped after…”, “Failed after…”).
- open / defaultOpen / onOpenChange
boolean / boolean / (open) => void- Default
open while thinking - Control the panel. The header is a button with aria-expanded.
- collapseOnDone
boolean- Default
true - Fold the panel when the status turns done.
- onDone
(seconds) => void- Fires once each time the status turns done.
- maxSources
number- Default
4 - Source chips per step before “+N” (a BadgeGroup: tooltip lists the rest, click shows all).
- indicator
"grid"|"chain"|"ring"|"bars"- Default
breathing dot - While thinking, swaps the header dot for a moving mark (see Thinking indicator).
- variant
"panel"|"compact"- Default
"panel" - A quiet framed panel, or frameless and smaller to sit on top of / inside an AiAnswer.
- ThinkingStep.id / title
string- title is shown, announced (polite, throttled) and used in the header while the step runs.
- kind
"think"|"search"|"read"|"tool"|"step"- Picks the rail icon. Tools show their logo via toolIcon(tool).
- ThinkingStep.status
"running"|"done"|"failed"- Default
derived - Spinner, check or a red mark. Omit it and the last step follows the run.
- detail
ReactNode- A muted line under the title (a result, a query).
- sources
{ title, url?, favicon?, icon? }[]- Chips with favicon (or logo, or initial) and domain: real links, full title in a tooltip.
- tool
string- Tool name for kind "tool", e.g. "Postgres", "Slack", "GitHub".
- ThinkingStep.startedAt / endedAt
number|Date- Shows how long the step took.
| Prop | Type | Default | Description |
|---|---|---|---|
| steps | ThinkingStep[] | - | Your live steps, in order. Append and update them as events stream in. New steps rise in; the last one without a status follows the run. |
| status | "thinking" | "done" | "stopped" | "failed" | "thinking" | The run. Thinking opens the panel with a shimmering label and a live timer; done folds it to “Thought for 12s”. |
| startedAt / endedAt | number | Date | - | Run timing (ms or Date). Without them, and without elapsed, the component times the run itself. |
| elapsed | number | - | Seconds spent, if you track it. Wins over startedAt / endedAt. |
| reasoning | string | - | Streaming reasoning, muted under the steps. Shows the newest lines while live, with Show more / Show less. |
| reasoningLines | number | 3 | Lines shown before Show more. |
| label | string | "Thinking…" | Header text while running when no step is running. |
| endedLabel | (status, seconds) => ReactNode | “Thought for 12s” | Header text once the run ended (also “Stopped after…”, “Failed after…”). |
| open / defaultOpen / onOpenChange | boolean / boolean / (open) => void | open while thinking | Control the panel. The header is a button with aria-expanded. |
| collapseOnDone | boolean | true | Fold the panel when the status turns done. |
| onDone | (seconds) => void | - | Fires once each time the status turns done. |
| maxSources | number | 4 | Source chips per step before “+N” (a BadgeGroup: tooltip lists the rest, click shows all). |
| indicator | "grid" | "chain" | "ring" | "bars" | breathing dot | While thinking, swaps the header dot for a moving mark (see Thinking indicator). |
| variant | "panel" | "compact" | "panel" | A quiet framed panel, or frameless and smaller to sit on top of / inside an AiAnswer. |
| ThinkingStep.id / title | string | - | title is shown, announced (polite, throttled) and used in the header while the step runs. |
| kind | "think" | "search" | "read" | "tool" | "step" | - | Picks the rail icon. Tools show their logo via toolIcon(tool). |
| ThinkingStep.status | "running" | "done" | "failed" | derived | Spinner, check or a red mark. Omit it and the last step follows the run. |
| detail | ReactNode | - | A muted line under the title (a result, a query). |
| sources | { title, url?, favicon?, icon? }[] | - | Chips with favicon (or logo, or initial) and domain: real links, full title in a tooltip. |
| tool | string | - | Tool name for kind "tool", e.g. "Postgres", "Slack", "GitHub". |
| ThinkingStep.startedAt / endedAt | number | Date | - | Shows how long the step took. |
Thinking indicator
npx knowns-ui@latest add thinking-indicatorPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Thinking indicator from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/thinking-state
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add thinking-indicator
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/illustrations/illust-utils.ts
- components/ui/knowns/illustrations/use-in-view.ts
- components/ui/knowns/text-animation/text-core.tsx
- components/ui/knowns/text-animation/shimmer-text.tsx
- components/ui/knowns/thinking-state/thinking-indicator.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/thinking-state, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "thinking-indicator" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.- variant
"grid"|"chain"|"ring"|"bars"- Default
"grid" - The glyph: a 3x3 dot grid crossed by a diagonal wave, a pulse travelling along a node chain, a ring that fills and resets, or three bars breathing out of phase.
- label
string- Default
"Thinking" - The status, e.g. "Searching the docs". Screen readers get it once; the timer is silent.
- showTimer
boolean- Default
true - The elapsed timer after the label, in tenths of a second (“2.3s”), then “1m 05s”.
- shimmer
boolean- Default
true - Sweep a light band through the label.
- tone
"accent"|"neutral"- Default
"accent" - Tint the glyph with --kn-accent, or keep it in the text colour.
- active
boolean- Default
true - Run the glyph, the shimmer and the timer. false freezes the glyph and keeps the last time.
- elapsed
number- Seconds spent, if you track it. Without it the indicator times itself.
- size
number- Default
16 - Edge of the glyph in px. ThinkingMark renders just the glyph.
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "grid" | "chain" | "ring" | "bars" | "grid" | The glyph: a 3x3 dot grid crossed by a diagonal wave, a pulse travelling along a node chain, a ring that fills and resets, or three bars breathing out of phase. |
| label | string | "Thinking" | The status, e.g. "Searching the docs". Screen readers get it once; the timer is silent. |
| showTimer | boolean | true | The elapsed timer after the label, in tenths of a second (“2.3s”), then “1m 05s”. |
| shimmer | boolean | true | Sweep a light band through the label. |
| tone | "accent" | "neutral" | "accent" | Tint the glyph with --kn-accent, or keep it in the text colour. |
| active | boolean | true | Run the glyph, the shimmer and the timer. false freezes the glyph and keeps the last time. |
| elapsed | number | - | Seconds spent, if you track it. Without it the indicator times itself. |
| size | number | 16 | Edge of the glyph in px. ThinkingMark renders just the glyph. |
What it handles
- 01Lists steps of kind think, search, read, tool or step, with the status of each derived from the run when you leave it out.
- 02Shows the running step's title in the header with a shimmer, and "Thought for 12s" once done, or "Stopped after" or "Failed after" with the seconds.
- 03Times the run itself when you give no startedAt, endedAt or elapsed, and calls onDone once with the seconds when it turns done.
- 04Shows sources under a step as badges up to maxSources, then +N, and the tool logo for kind tool steps.
- 05Streams reasoning text muted under the steps, capped at reasoningLines, 3 by default, with Show more.
- 06Opens while thinking and collapses itself when done unless you turn that off, announces new step titles to screen readers at most every 1.5 seconds, and swaps the dot for a mark with indicator or leading.
States
- First render
- Nothing. It paints as it is
- none
- Panel opens or closes
- The body folds and fades
- 180ms, ease out
- Chevron turns
- It rotates when the panel opens
- 180ms, ease out
- Header hover
- Colour and background change
- 120ms, ease out
- Running step title
- A light band sweeps across the text
- none
- Reduced motion
- Fold and chevron change at once, the sweep stops
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. It paints as it is | none |
| Panel opens or closes | The body folds and fades | 180ms, ease out |
| Chevron turns | It rotates when the panel opens | 180ms, ease out |
| Header hover | Colour and background change | 120ms, ease out |
| Running step title | A light band sweeps across the text | none |
| Reduced motion | Fold and chevron change at once, the sweep stops | 0ms |
Works with
When to use
When to use
- Showing what an agent does before it replies: live steps, sources searched, tool calls and streaming reasoning.
- Collapsing that work into a short summary such as Thought for 12s once the answer starts.
When not to use
- A plain in-progress label with no steps: use Shimmer Text.
- Full debugging of the run's calls: use Trace Waterfall.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Thinking State to my app and wire it to my own data.
- I need showing what an agent does before it replies: live steps, sources searched, tool calls and streaming reasoning. Set that up with the Knowns UI Thinking State.
- Which Thinking State props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "thinking-state" }) and search_docs({ query: "thinking state" }).