Command Palette

Search for a command to run...

AI Elements / Agentic/AI Chain of Thought

AI Chain of Thought

Visualize AI reasoning steps with search results and images for step-by-step thinking display.

Open in v0Open in

Step 1

Analyzing the current project structure and dependencies

Step 2

Searching for authentication best practices

Step 3

Reviewing architecture diagram
System architecture diagram
Current system architecture

Step 4

Generating implementation plan

Review

Code review completed

Security

No security issues found

Overview

A compound component for visualizing AI reasoning as a series of steps. Each step can have a status (pending, active, complete) and include search results or images. Built with Radix Collapsible.

Installation

bunx shadcn@latest add @elements/chain-of-thought

Usage

import {
  ChainOfThought,
  ChainOfThoughtHeader,
  ChainOfThoughtContent,
  ChainOfThoughtStep,
  ChainOfThoughtSearchResults,
  ChainOfThoughtImage,
} from "@/components/elements/ai-elements/agentic/chain-of-thought";

export function ChainOfThoughtExample() {
  return (
    <ChainOfThought>
      <ChainOfThoughtHeader stepCount={3} completedCount={2} />
      <ChainOfThoughtContent>
        <ChainOfThoughtStep
          status="complete"
          title="Understanding the question"
          description="Parsed user intent and extracted key entities"
        />
        <ChainOfThoughtStep
          status="complete"
          title="Searching for information"
        >
          <ChainOfThoughtSearchResults
            results={[
              { title: "React Docs", url: "https://react.dev", snippet: "..." },
            ]}
          />
        </ChainOfThoughtStep>
        <ChainOfThoughtStep
          status="active"
          title="Formulating response"
        />
      </ChainOfThoughtContent>
    </ChainOfThought>
  );
}

Props

ChainOfThought

PropTypeDefaultDescription
defaultOpenbooleantrueInitial open state
openboolean-Controlled open state
onOpenChange(open: boolean) => void-Callback when open state changes

ChainOfThoughtHeader

PropTypeDefaultDescription
titlestring"Chain of Thought"Header title
stepCountnumber-Total number of steps
completedCountnumber-Number of completed steps

ChainOfThoughtStep

PropTypeDescription
statusStepStatusStep status: pending, active, complete
titlestringStep title
descriptionstringOptional description

ChainOfThoughtSearchResults

PropTypeDescription
resultsSearchResult[]Array of search results

ChainOfThoughtImage

PropTypeDescription
srcstringImage source URL
altstringAlt text
captionstringOptional caption

Features

  • Step-by-step visualization with timeline
  • Status icons with animations
  • Search results with external links
  • Image support with loading states
  • Collapsible with smooth animations
  • Amber-themed lightbulb icon