Chain of Thought
A collapsible step-by-step trace timeline with staggered step reveals, drawn vertical connectors, stroke checkmarks, and search result badges.
Customize
Installation
npx shadcn@latest add @kinetic/chain-of-thoughtUsage
Nest ChainOfThoughtHeader and ChainOfThoughtContent inside ChainOfThought, then populate steps with ChainOfThoughtStep.
import {
ChainOfThought,
ChainOfThoughtContent,
ChainOfThoughtHeader,
ChainOfThoughtSearchResult,
ChainOfThoughtSearchResults,
ChainOfThoughtStep,
} from "@/components/kinetic/ui/chain-of-thought";
export function TraceTimeline() {
return (
<ChainOfThought defaultOpen>
<ChainOfThoughtHeader>Research plan</ChainOfThoughtHeader>
<ChainOfThoughtContent>
<ChainOfThoughtStep
label="Scan workspace layout"
description="Located registry specs and content files."
status="complete"
/>
<ChainOfThoughtStep label="Inspect source references" status="active">
<ChainOfThoughtSearchResults>
<ChainOfThoughtSearchResult>effects.ts</ChainOfThoughtSearchResult>
<ChainOfThoughtSearchResult>spring.ts</ChainOfThoughtSearchResult>
</ChainOfThoughtSearchResults>
</ChainOfThoughtStep>
<ChainOfThoughtStep label="Publish output" status="pending" />
</ChainOfThoughtContent>
</ChainOfThought>
);
}Step states and media
Set status on each ChainOfThoughtStep to complete, active, or pending. Completed steps draw a stroke checkmark, active steps display a spinner indicator, and vertical connectors draw along the Y axis. Add ChainOfThoughtSearchResults or ChainOfThoughtImage inside any step for retrieved pills or captioned screenshots.
interface StepImageProps {
readonly src: string;
readonly caption: string;
}
export function TraceSnapshot({ src, caption }: StepImageProps) {
return (
<ChainOfThoughtImage caption={caption}>
<img src={src} alt={caption} className="max-h-48 rounded-md object-contain" />
</ChainOfThoughtImage>
);
}Motion preferences
Step rows stagger with staggerMs (95 ms default), blurPx (8 px default), and speed (0.45 default). Under reduced motion, spinners, staggers, and height springs settle immediately.
API Reference
ChainOfThought
Zero-dependency trace container coordinating spring collapse, staggered step reveal, connector scaleDraw, and checkmark drawStroke.
| Prop | Type | Default | Description |
|---|---|---|---|
open / defaultOpen / onOpenChange | boolean / boolean / (open: boolean) => void | true | Controlled or initial expanded state. |
speed / blurPx / staggerMs | number / number / number | 0.45 / 8 / 95 | Speed multiplier, blur radius (px), and delay between sequential step rows (ms). |
animated / keepMounted / disabled | boolean / boolean / boolean | true / false / false | Enables motion effects, retains DOM content when closed, or locks toggling. |
ChainOfThoughtHeader / ChainOfThoughtContent
Rotating-chevron header trigger and spring height-animated step container.
| Prop | Type | Default | Description |
|---|---|---|---|
keepMounted / forceMount (ChainOfThoughtContent) | boolean / boolean | false | Keeps step elements mounted while collapsed. |
ChainOfThoughtStep
Timeline step with drawStroke checkmark, active indicator, and scaleDraw vertical connector.
| Prop | Type | Default | Description |
|---|---|---|---|
label / description / icon | React.ReactNode / React.ReactNode / ChainOfThoughtStepIcon | - | Primary step label, optional subtitle, and custom icon override. |
status | "complete" | "active" | "pending" | "complete" | Controls stroke-draw checkmark, active indicator, or pending dot styling. |
ChainOfThoughtSearchResults / ChainOfThoughtSearchResult / ChainOfThoughtImage
Pop-in source pills and directional-swap image preview slot.
| Prop | Type | Default | Description |
|---|---|---|---|
caption (ChainOfThoughtImage) | React.ReactNode | - | Optional caption displayed underneath the image frame. |