Chain of Thought

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.

Searching for profiles for Hayden Bleasel
www.x.comwww.instagram.comwww.github.com
Found the profile photo for Hayden Bleasel
Example generated image

Hayden Bleasel's profile photo from x.com, showing a Ghibli-style man.

Hayden Bleasel is an Australian product designer, software engineer, and founder. He is currently based in the United States working for Vercel, an American cloud application company.
Searching for recent work...
www.github.comwww.dribbble.com

Installation

pnpm dlx shadcn-svelte@latest add https://svelte-ai-elements.vercel.app/r/chain-of-thought.json

If you prefer using jsrepo, please install via the command below:

pnpm dlx jsrepo add @ai/elements/ai-elements/chain-of-thought

Usage

Props

ChainOfThought

PropTypeDefaultDescription
openboolean-Controls whether the chain of thought is expanded (bindable)
defaultOpenbooleanfalseWhether the chain of thought is expanded by default
onOpenChange(open: boolean) => void-Callback function called when the open state changes
classstring-Additional CSS classes to apply to the container
childrenSnippet-Child components (typically ChainOfThoughtHeader and ChainOfThoughtContent)
...restPropsHTMLAttributes<HTMLDivElement>-All other div props are supported

ChainOfThoughtHeader

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the header trigger
childrenSnippet-Custom content to render instead of the default 'Chain of Thought' text

ChainOfThoughtContent

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the content container
childrenSnippet-Chain of thought steps and content to display when expanded

ChainOfThoughtStep

PropTypeDefaultDescription
labelstring-The main label/title for the step
icontypeof Icon-Lucide icon component to display for the step
descriptionstring-Optional description text for the step
status'complete' | 'active' | 'pending''complete'Visual status of the step
delaynumber-Custom animation delay in milliseconds (defaults to 150ms * step index)
classstring-Additional CSS classes to apply to the step
childrenSnippet-Additional content to display within the step
...restPropsHTMLAttributes<HTMLDivElement>-All other div props are supported

ChainOfThoughtImage

PropTypeDefaultDescription
captionstring-Caption text to display below the image
classstring-Additional CSS classes to apply to the image container
childrenSnippet-Image element or content to display
...restPropsHTMLAttributes<HTMLDivElement>-All other div props are supported

ChainOfThoughtSearchResults

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the search results container
childrenSnippet-ChainOfThoughtSearchResult components to display
...restPropsHTMLAttributes<HTMLDivElement>-All other div props are supported

ChainOfThoughtSearchResult

PropTypeDefaultDescription
classstring-Additional CSS classes to apply to the search result badge
childrenSnippet-Content to display in the search result badge
...restPropsHTMLAttributes<HTMLElement>-All other Badge component props are supported