AI reasoningPro
A collapsible thinking trace that folds into a summary when done.
When to use
- Showing a model's steps while it works, then folding them away.
When not to use
- The final answer itself.
Installation
Usage
Import it from @/components/ui/ai-reasoning after installing.
example.tsx
import { AiReasoning } from "@/components/ui/ai-reasoning";
export function Trace({ steps, thinking }: { steps: string[]; thinking: boolean }) {
return <AiReasoning steps={steps} thinking={thinking} seconds={4} />;
}Built fromShimmer text
API reference
AiReasoning
Open while streaming; folds into a summary when done.
| Prop | Type | Default | Description |
|---|---|---|---|
| steps | string[] | – | Steps as they arrive. |
| thinking | boolean | – | True while working. |
| seconds | number | – | Shown when done. |
Keyboard interactions
| Keys | Action |
|---|---|
| EnterorSpace | Expand or collapse |
Accessibility
- The toggle uses aria-expanded.
Motion
- Steps slide in; the header shimmers while thinking; folds on completion.
Responsive behavior
- Full width.
Performance
- Append steps; don't replace the array each token.
Notes for AI
- Set thinking=false when the answer starts streaming.
This page as Markdown, for assistants and coding agents:
/components/ai-reasoning/markdownThe full library index for assistants is at /llms.txt.
Lode222 doc pagesllms.txt