• Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
drewmcdonald

drewmcdonald

promptCompare

Public
Like
promptCompare
Home
Code
7
.claude
3
backend
3
docs
4
frontend
4
shared
1
.mcp.json
deno.json
Environment variables
2
Branches
1
Pull requests
Remixes
History
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data – all from the browser, and deployed in milliseconds.
Sign up now
Code
/
.claude
/
skills
/
ai-elements
/
references
/
chain-of-thought.md
Code
/
.claude
/
skills
/
ai-elements
/
references
/
chain-of-thought.md
Search
…
Viewing readonly version of main branch: v164
View latest version
chain-of-thought.md

Chain of Thought

A collapsible component that visualizes AI reasoning steps with support for search results, images, and step-by-step progress indicators.

The ChainOfThought component provides a visual representation of an AI's reasoning process, showing step-by-step thinking with support for search results, images, and progress indicators. It helps users understand how AI arrives at conclusions.

See scripts/chain-of-thought.tsx for this example.

Installation

npx ai-elements@latest add chain-of-thought

Features

  • Collapsible interface with smooth animations powered by Radix UI
  • Step-by-step visualization of AI reasoning process
  • Support for different step statuses (complete, active, pending)
  • Built-in search results display with badge styling
  • Image support with captions for visual content
  • Custom icons for different step types
  • Context-aware components using React Context API
  • Fully typed with TypeScript
  • Accessible with keyboard navigation support
  • Responsive design that adapts to different screen sizes
  • Smooth fade and slide animations for content transitions
  • Composable architecture for flexible customization

Props

<ChainOfThought />

PropTypeDefaultDescription
openboolean-Controlled open state of the collapsible.
defaultOpenbooleanfalseDefault open state when uncontrolled.
onOpenChange(open: boolean) => void-Callback when the open state changes.
...propsReact.ComponentProps<-Any other props are spread to the root div element.

<ChainOfThoughtHeader />

PropTypeDefaultDescription
childrenReact.ReactNode-Custom header text.
...propsReact.ComponentProps<typeof CollapsibleTrigger>-Any other props are spread to the CollapsibleTrigger component.

<ChainOfThoughtStep />

PropTypeDefaultDescription
iconLucideIconDotIconIcon to display for the step.
labelstring-The main text label for the step.
descriptionstring-Optional description text shown below the label.
statusunknown-Visual status of the step.
...propsReact.ComponentProps<-Any other props are spread to the root div element.

<ChainOfThoughtSearchResults />

PropTypeDefaultDescription
...propsReact.ComponentProps<-Any props are spread to the container div element.

<ChainOfThoughtSearchResult />

PropTypeDefaultDescription
...propsReact.ComponentProps<typeof Badge>-Any props are spread to the Badge component.

<ChainOfThoughtContent />

PropTypeDefaultDescription
...propsReact.ComponentProps<typeof CollapsibleContent>-Any props are spread to the CollapsibleContent component.

<ChainOfThoughtImage />

PropTypeDefaultDescription
captionstring-Optional caption text displayed below the image.
...propsReact.ComponentProps<-Any other props are spread to the container div element.
FeaturesVersion controlCode intelligenceCLIMCP
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Open Source Pledge
Terms of usePrivacy policyAbuse contact
© 2026 Val Town, Inc.