Skip to main content

Chain of Thought

A collapsible step-by-step trace timeline with staggered step reveals, drawn vertical connectors, stroke checkmarks, and search result badges.

Scan registry manifest (complete)
Resolved entrypoints and spring token contracts.
Inspect shared helpers (active)
effects.tsspring.tsuse-animated-size.ts
Verify ARIA & reduced motion (pending)
Confirmed accessible status labels and instant settle fallback.

Customize

Speed0.45
Blur reveal (px)8
Step stagger (ms)95

Installation

npx shadcn@latest add @kinetic/chain-of-thought

Usage

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.

PropTypeDefaultDescription
open / defaultOpen / onOpenChangeboolean / boolean / (open: boolean) => voidtrueControlled or initial expanded state.
speed / blurPx / staggerMsnumber / number / number0.45 / 8 / 95Speed multiplier, blur radius (px), and delay between sequential step rows (ms).
animated / keepMounted / disabledboolean / boolean / booleantrue / false / falseEnables motion effects, retains DOM content when closed, or locks toggling.

ChainOfThoughtHeader / ChainOfThoughtContent

Rotating-chevron header trigger and spring height-animated step container.

PropTypeDefaultDescription
keepMounted / forceMount (ChainOfThoughtContent)boolean / booleanfalseKeeps step elements mounted while collapsed.

ChainOfThoughtStep

Timeline step with drawStroke checkmark, active indicator, and scaleDraw vertical connector.

PropTypeDefaultDescription
label / description / iconReact.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.

PropTypeDefaultDescription
caption (ChainOfThoughtImage)React.ReactNode-Optional caption displayed underneath the image frame.