Skip to content

Thinking State

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
Used for
  • Show agent thinking
  • List sources searched
  • Stream reasoning text
  • Summarise thinking time
  • Header above an answer

Examples

Installation

npx knowns-ui@latest add thinking-state
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.

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
Default3
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
Defaultopen while thinking
Control the panel. The header is a button with aria-expanded.
collapseOnDone
boolean
Defaulttrue
Fold the panel when the status turns done.
onDone
(seconds) => void
Fires once each time the status turns done.
maxSources
number
Default4
Source chips per step before “+N” (a BadgeGroup: tooltip lists the rest, click shows all).
indicator
"grid" | "chain" | "ring" | "bars"
Defaultbreathing 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"
Defaultderived
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

Glyph
Tone
npx knowns-ui@latest add thinking-indicator
For Claude Code, Cursor or Codex: installs it and wires the props to your own data.
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
Defaulttrue
The elapsed timer after the label, in tenths of a second (“2.3s”), then “1m 05s”.
shimmer
boolean
Defaulttrue
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
Defaulttrue
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
Default16
Edge of the glyph in px. ThinkingMark renders just the glyph.

What it handles

  1. 01Lists steps of kind think, search, read, tool or step, with the status of each derived from the run when you leave it out.
  2. 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.
  3. 03Times the run itself when you give no startedAt, endedAt or elapsed, and calls onDone once with the seconds when it turns done.
  4. 04Shows sources under a step as badges up to maxSources, then +N, and the tool logo for kind tool steps.
  5. 05Streams reasoning text muted under the steps, capped at reasoningLines, 3 by default, with Show more.
  6. 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

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

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" }).

Need help?

Stuck on Thinking State, or found something off? We read every message.