ChainOfThought
neon-ui/chain-of-thoughtFreeComponent
Collapsible step-by-step reasoning rail with statuses, search-result chips, and images.
Install it
npx shadcn@latest add https://ui.neon.com/r/chain-of-thought.jsonSource
1"use client";23import { Collapsible } from "@base-ui/react/collapsible";4import { ArrowRight01Icon } from "@hugeicons/core-free-icons";5import { HugeiconsIcon } from "@hugeicons/react";6import type { ComponentProps, ReactNode } from "react";78import { Badge } from "@/components/ui/badge";9import { cn } from "@/lib/utils";1011export type ChainOfThoughtProps = Collapsible.Root.Props;1213/* ─────────────────────────────────────────────────────14 * Discrete, labeled reasoning steps — searches, tool15 * calls, drafts — folded behind the house log-line rail.16 * Reasoning is for one continuous thinking stream; this17 * is for steps the reader can scan one by one.18 * Inspired by Chain of Thought from Vercel's AI SDK19 * Elements (elements.ai-sdk.dev), rebuilt on Base UI.20 * ─────────────────────────────────────────────────── */21export const ChainOfThought = ({22 className,23 ...props24}: ChainOfThoughtProps) => (25 <Collapsible.Root26 className={cn(27 "w-full min-w-0 border-border/60 border-l-2 pl-2.5",28 className29 )}30 data-slot="chain-of-thought"31 {...props}32 />33);3435export type ChainOfThoughtHeaderProps = Collapsible.Trigger.Props;3637/** The fold's handle. Defaults to "Chain of thought"; children replace it. */38export const ChainOfThoughtHeader = ({39 children,40 className,41 ...props42}: ChainOfThoughtHeaderProps) => (43 <Collapsible.Trigger44 className={cn(45 "group inline-flex items-center gap-1 py-0.5 text-muted-foreground text-xs transition-colors hover:text-foreground",46 className47 )}48 data-slot="chain-of-thought-header"49 {...props}50 >51 <HugeiconsIcon52 aria-hidden53 className="size-3 transition-transform duration-200 group-data-[panel-open]:rotate-90 motion-reduce:transition-none"54 icon={ArrowRight01Icon}55 strokeWidth={2}56 />57 {children ?? <span>Chain of thought</span>}58 </Collapsible.Trigger>59);6061export type ChainOfThoughtContentProps = Collapsible.Panel.Props;6263/** The unfolding step list. Children are `ChainOfThoughtStep` items. */64export const ChainOfThoughtContent = ({65 children,66 className,67 ...props68}: ChainOfThoughtContentProps) => (69 <Collapsible.Panel70 className={cn(71// … truncated
What it pulls in
npm packages
Other registry items
Files it writes
More from neon-ui
All 77 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| ActivityFeedactivity-feed | neon-ui | Components | Free | 2 deps | |
| AgentChatagent-chat | neon-ui | Components | Free | 6 deps | |
| AnimatedWashanimated-wash | neon-ui | Components | Free | no deps · 2 files | |
| ApiKeyListapi-key-list | neon-ui | Components | Free | 2 deps | |
| AppCardapp-card | neon-ui | Components | Free | 2 deps | |
| AppCreatorapp-creator | neon-ui | Components | Free | 2 deps | |
| AuthFormauth-form | neon-ui | Components | Free | no deps | |
| AutoscaleChartautoscale-chart | neon-ui | Components | Free | 1 dep |
