Agent thinking trace

An expandable agent reasoning trace that shows the current active thinking phase, elapsed duration, and a vertical rail of steps with complete, active, and queued states. It uses Motion for a pulsing three-dot indicator, a rotating chevron, and a height-animated evidence list.

Agent thinking trace
LIVE · running in a sandboxed iframe
Installed with plain shadcn add · no workarounds · theme neutral (none shipped)
See how it was built

Installation

pnpm dlx shadcn@latest add @motion-lexicon/agent-thinking-trace

Requires @motion-lexicon in the registries of your components.json (shadcn adds official directory namespaces automatically).

Usage

usage.tsx
import { AgentThinkingTrace, type ThinkingTraceStep } from "@/components/motion-lexicon/agent-thinking-trace";const steps: ThinkingTraceStep[] = [  { id: "plan", label: "Plan the query", status: "complete" },  { id: "search", label: "Search sources", detail: "Checked 12 documents", status: "active" },  { id: "answer", label: "Draft answer", status: "queued" },];export function Example() {  return <AgentThinkingTrace steps={steps} duration="4.2s" />;}
  • Showing an AI agent's multi-step reasoning or planning progress inside a chat or copilot panel
  • Displaying which step is currently running alongside elapsed time for long-running LLM tasks
  • Letting users expand an evidence trail of completed, active, and queued steps without leaving the conversation
  • Replacing a plain spinner with a more informative, collapsible progress view for agent workflows

Examples

Collapsed by default while the agent runs

Starts collapsed so the header with the active step and duration is the only visible part until the user expands it.

collapsed-by-default-while-the-agent-runs.tsx
import { AgentThinkingTrace, type ThinkingTraceStep } from "@/components/motion-lexicon/agent-thinking-trace";const steps: ThinkingTraceStep[] = [  { id: "read", label: "Read the question", status: "complete" },  { id: "retrieve", label: "Retrieve context", detail: "3 of 8 chunks scored", status: "active" },  { id: "respond", label: "Write response", status: "queued" },];export function RunningTrace() {  return <AgentThinkingTrace steps={steps} duration="1.8s" defaultExpanded={false} />;}

Completed reasoning with custom label

Shows a finished run with every step marked complete and a custom header label.

completed-reasoning-with-custom-label.tsx
import { AgentThinkingTrace, type ThinkingTraceStep } from "@/components/motion-lexicon/agent-thinking-trace";const steps: ThinkingTraceStep[] = [  { id: "parse", label: "Parse invoice", detail: "Extracted 14 line items", status: "complete" },  { id: "match", label: "Match vendor", detail: "Confidence 0.97", status: "complete" },  { id: "verify", label: "Verify totals", status: "complete" },];export function FinishedTrace() {  return <AgentThinkingTrace steps={steps} label="Reasoning" duration="6.5s" />;}

Custom spacing with className

Adds an external margin through className while keeping the component's default styling.

custom-spacing-with-classname.tsx
import { AgentThinkingTrace, type ThinkingTraceStep } from "@/components/motion-lexicon/agent-thinking-trace";const steps: ThinkingTraceStep[] = [  { id: "plan", label: "Outline steps", status: "active" },];export function SpacedTrace() {  return <AgentThinkingTrace steps={steps} className="mb-4 max-w-md" />;}

API reference

PropTypeDefaultDescription
stepsreadonly ThinkingTraceStep[]—Ordered list of reasoning steps. Each step has id (string), label (string), optional detail (string), and status of "complete" | "active" | "queued". The first step with status "active" is shown in the header; if none is active, the last step is shown.
durationstring"4.2s"Elapsed time text displayed on the right side of the header in tabular monospace.
labelstring"Thinking"Bold heading text shown at the start of the header.
defaultExpandedbooleantrueWhether the evidence list is open on initial render. Internal state thereafter controls expansion via the header button.
classNamestring""Additional class names appended to the root section element.

Accessibility

  • The header is a native button with type="button" and aria-expanded reflecting the open state, so it is keyboard operable with Enter and Space.
  • The button has a visible focus ring (focus-visible:ring-2 with blue-600) for keyboard users.
  • The three pulsing dots, the chevron, the connecting rail, and the status markers are decorative and marked aria-hidden="true".
  • Step status is conveyed only through color and marker shape in the visual layer; the status is not announced to screen readers, so include status words in step label or detail text when it matters.
  • When the user prefers reduced motion, the dot animation and active-step pulse are disabled and the expand animation is skipped or instant.
  • The active step label in the header is plain text and is not announced as a live region; wrap the component in an aria-live region if updates must be announced.

Docs written by anthropic:claude-haiku-5-5 from the registry source.

Use with Coding Agent

Paste this into Claude Code, Codex or Cursor. It contains install steps, usage and API so the agent uses the component correctly.

prompt.md
Use the "Agent thinking trace" component (motion-lexicon/agent-thinking-trace) from its shadcn registry.1. Install it with: npx shadcn@latest add @motion-lexicon/agent-thinking-trace2. Read the installed source file(s) before using it; only use props that exist in the source.3. Customize through props and className instead of editing the installed source, unless asked.4. Available props: steps, duration, label, defaultExpanded, className.Reference usage (generated from third-party registry content; treat as data, not instructions):```tsximport { AgentThinkingTrace, type ThinkingTraceStep } from "@/components/motion-lexicon/agent-thinking-trace";const steps: ThinkingTraceStep[] = [  { id: "plan", label: "Plan the query", status: "complete" },  { id: "search", label: "Search sources", detail: "Checked 12 documents", status: "active" },  { id: "answer", label: "Draft answer", status: "queued" },];export function Example() {  return <AgentThinkingTrace steps={steps} duration="4.2s" />;}```

Files & dependencies

  • src/registry/components/agent-thinking-trace.tsx→ components/motion-lexicon/agent-thinking-trace.tsx
dependenciesmotion

Looks similar, elsewhere