BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/nexus-ui/chain-of-thought

Chain of Thought

nexus-ui/chain-of-thought
FreeComponent

Structured multi-step thought timeline with step status, optional expandable output, and auto-close when steps finish

Live preview

live · rendered by the registry
Rendered by nexus-ui on their own page — this is the component running, not a screenshot of it.

Install it

npx shadcn@latest add https://nexus-ui.dev/r/chain-of-thought.json

Source

components/nexus-ui/chain-of-thought.tsxnexus-ui.dev/r/chain-of-thought.json · first 6 KB
1"use client";
2
3import * as React from "react";
4import { Alert02Icon, ArrowDown01Icon } from "@hugeicons/core-free-icons";
5import { HugeiconsIcon } from "@hugeicons/react";
6
7import {
8 Collapsible,
9 CollapsibleContent,
10 CollapsibleTrigger,
11} from "@/components/ui/collapsible";
12import { TextShimmer } from "@/components/nexus-ui/text-shimmer";
13import { useOnChange } from "@/lib/use-on-change";
14import { cn } from "@/lib/utils";
15
16type ChainOfThoughtRootContextValue = {
17 registerStep: (id: string, status: ChainOfThoughtStepStatus) => void;
18 allStepsComplete: boolean;
19 hasAnyError: boolean;
20};
21
22const ChainOfThoughtRootContext =
23 React.createContext<ChainOfThoughtRootContextValue | null>(null);
24
25function useChainOfThoughtRootContext(component: string) {
26 const ctx = React.useContext(ChainOfThoughtRootContext);
27 if (!ctx) {
28 throw new Error(`${component} must be used within <ChainOfThought>`);
29 }
30 return ctx;
31}
32
33type ChainOfThoughtStepContextValue = {
34 status: ChainOfThoughtStepStatus;
35 hasContent: boolean;
36};
37
38const ChainOfThoughtStepContext =
39 React.createContext<ChainOfThoughtStepContextValue | null>(null);
40
41function useChainOfThoughtStepContext(component: string) {
42 const ctx = React.useContext(ChainOfThoughtStepContext);
43 if (!ctx) {
44 throw new Error(`${component} must be used within <ChainOfThoughtStep>`);
45 }
46 return ctx;
47}
48
49type ChainOfThoughtStepStatus = "pending" | "active" | "completed" | "error";
50
51type ChainOfThoughtProps = Omit<
52 React.ComponentProps<typeof Collapsible>,
53 "open" | "defaultOpen" | "onOpenChange"
54> & {
55 open?: boolean;
56 defaultOpen?: boolean;
57 onOpenChange?: (open: boolean) => void;
58 autoCloseOnAllComplete?: boolean;
59};
60
61function ChainOfThought({
62 className,
63 open: openProp,
64 defaultOpen = true,
65 onOpenChange,
66 autoCloseOnAllComplete = true,
67 children,
68 ...props
69}: ChainOfThoughtProps) {
70 const isControlled = openProp !== undefined;
71 const [internalOpen, setInternalOpen] = React.useState(defaultOpen);
72 const [stepStatuses, setStepStatuses] = React.useState<
73 Record<string, ChainOfThoughtStepStatus>
74 >({});
75
76 const { allStepsComplete, hasAnyError } = React.useMemo(() => {
77 const statuses = Object.values(stepStatuses);
78 return {
79 allStepsComplete:
80 statuses.length > 0 &&
81 statuses.every((status) => status === "completed"),
82 hasAnyError: statuses.some((status) => status === "error"),
83 };
84 }, [stepStatuses]);
85
86 const open = isControlled ? openProp : internalOpen;
87
88// … truncated

What it pulls in

npm packages

  • @hugeicons/react
  • @hugeicons/core-free-icons

Other registry items

  • collapsible

Files it writes

  • components/nexus-ui/chain-of-thought.tsx
  • lib/use-on-change.ts

Facts

Registry
nexus-ui
Type
registry:ui
Access
Free
Files written
2
Licence
the repository states none
First indexed
2026-08-01
Last confirmed
today

Go to the source

Docs on nexus-ui nexus-ui.dev victorcodess/nexus-ui on GitHub Raw registry item This item as JSON

More from nexus-ui

All 15 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Attachmentsattachmentsnexus-uiComponentsFree4 deps · 2 files
Citationcitationnexus-uiComponentsFree4 deps
Feedback Barfeedback-barnexus-uiComponentsFree1 dep
Imageimagenexus-uiComponentsFree2 deps
Messagemessagenexus-uiComponentsFree9 deps · 2 files
Model Selectormodel-selectornexus-uiComponentsFree3 deps
Prompt Inputprompt-inputnexus-uiComponentsFree1 dep
Questionsquestionsnexus-uiComponentsFree2 deps
BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex

BlockDex

Built by

Kynth Studio

Index

Components
Registries
Method
Open API

Guides

shadcn component libraries
Best shadcn registries
Free shadcn blocks

Reference

Corpus counts
Crawl health
hello@kynth.studio
Privacy
Terms

BlockDex