Chain of thought

Thinking laid out as steps: a status list, a one-line summary that opens up, a research trail of searches and pages read, options weighed and ruled out, and steps woven into the answer as it writes.

Loading preview…

Install

  1. 1

    Run this command in your Tailwind CSS project. It adds components/ai/chain-of-thought-default.tsx and installs its dependencies.

    $ npx shadcn@latest add https://gradientdeck.com/ai-components/r/chain-of-thought-default.json

Usage & API

Example

chain-of-thought-default.tsx
import { ChainOfThought } from "@/components/ai/chain-of-thought-default"

<ChainOfThought
  steps={[]}
/>

Props ChainOfThought

PropType & descriptionRequired
stepsChainStep[]Required

Dependencies

  • React
  • Tailwind CSS
  • motion
  • lucide-react
Implementation notes

Steps exports ChainOfThought with a single steps prop. The list is an ordered list labelled Progress. The active step sets aria-current to step, draws a pulse ring unless reduced motion is on, and shines its label. A done step shows a check and fills the connector from the previous icon. A pending step is grey, and its detail and sources stay hidden. Source marks are circles with the first letter of source.name, stacked with a slight overlap. The preview cycles four steps for a savings-account question: Searching with the detail high-yield savings accounts 2026, Reading 6 sources across nerdwallet.com, reddit.com, bankrate.com, investopedia.com, ft.com, and which.co.uk, then Comparing rates, fees and withdrawal limits, then Writing a short list.

Choosing a layout

Use Steps when you already have a short ordered plan and a status for each item, such as searching, reading, comparing, and writing. Use Collapsed summary when the steps are worth keeping but should not occupy the thread once the answer exists. Use Research trail when the interesting part is the queries and the pages, not a generic progress line. Use Options weighed when the model compared alternatives and rejected some. Use the woven answer when a lookup belongs in the middle of the paragraph it supports, not in a block above it.

Do not use these as a bibliography. The favicon row on a step, and the site chips inside a research action, are part of the trace. The full set of sources after the answer belongs to Sources list, and a marker inside a claim belongs to Inline citation. Do not use them for a pause before any step exists. That is Loader. And do not pass the finished answer as a step label unless you are using the woven variant, which is built to interleave text blocks and step chips.

Why does Collapsed summary hide the list while it is still working?

ThoughtSummary only mounts the step list when done is true and open is true. During the run it shows one label, the step at current, plus a counter. When you set done, current stops mattering and the button shows duration, which is already a string such as 14s, not a number of milliseconds. You own open through onOpenChange. The component does not open itself when the run finishes.

How do visible, revealed, and at differ?

They are three ways of saying how far a run has got, on three different components. OptionsWeighed uses two counts: visible options have been drawn, and decided of those have a verdict. ResearchTrail uses one count, revealed, which walks actions in order across steps, so a step can be half shown. WovenAnswer uses at as a block index and words as a word count inside a text block. Steps is different again: you set status on each ChainStep yourself. None of these props start a timer.