BlockDex

Components

Registries

Free blocks

Method

BlockDex

Components

Registries

Free blocks

Method

Open API

BlockDex

Components

Registries

Free blocks

Method

Open API

Components/prompt-kit/reasoning

Reasoning

prompt-kit-agents-ui/reasoning
FreeComponent

A collapsible component for showing AI reasoning, explanations, or logic. You can control it manually or let it auto-close when the stream ends. Markdown is supported.

Install it

npx shadcn@latest add https://raw.githubusercontent.com/agents-ui/agents-kit/main/public/c/reasoning.json

Source

reasoning.tsxraw.githubusercontent.com/agents-ui/agents-kit/main/public/c/reasoning.json
1"use client"
2
3import { cn } from "@/lib/utils"
4import { ChevronDownIcon } from "lucide-react"
5import React, {
6 createContext,
7 useContext,
8 useEffect,
9 useRef,
10 useState,
11} from "react"
12import { Markdown } from "./markdown"
13
14type ReasoningContextType = {
15 isOpen: boolean
16 onOpenChange: (open: boolean) => void
17}
18
19const ReasoningContext = createContext<ReasoningContextType | undefined>(
20 undefined
21)
22
23function useReasoningContext() {
24 const context = useContext(ReasoningContext)
25 if (!context) {
26 throw new Error(
27 "useReasoningContext must be used within a Reasoning provider"
28 )
29 }
30 return context
31}
32
33export type ReasoningProps = {
34 children: React.ReactNode
35 className?: string
36 open?: boolean
37 onOpenChange?: (open: boolean) => void
38 isStreaming?: boolean
39}
40function Reasoning({
41 children,
42 className,
43 open,
44 onOpenChange,
45 isStreaming,
46}: ReasoningProps) {
47 const [internalOpen, setInternalOpen] = useState(false)
48 const [wasAutoOpened, setWasAutoOpened] = useState(false)
49
50 const isControlled = open !== undefined
51 const isOpen = isControlled ? open : internalOpen
52
53 const handleOpenChange = (newOpen: boolean) => {
54 if (!isControlled) {
55 setInternalOpen(newOpen)
56 }
57 onOpenChange?.(newOpen)
58 }
59
60 useEffect(() => {
61 if (isStreaming && !wasAutoOpened) {
62 if (!isControlled) setInternalOpen(true)
63 setWasAutoOpened(true)
64 }
65
66 if (!isStreaming && wasAutoOpened) {
67 if (!isControlled) setInternalOpen(false)
68 setWasAutoOpened(false)
69 }
70 }, [isStreaming, wasAutoOpened, isControlled])
71
72 return (
73 <ReasoningContext.Provider
74 value={{
75 isOpen,
76 onOpenChange: handleOpenChange,
77 }}
78 >
79 <div className={className}>{children}</div>
80 </ReasoningContext.Provider>
81 )
82}
83
84export type ReasoningTriggerProps = {
85 children: React.ReactNode
86 className?: string
87} & React.HTMLAttributes<HTMLButtonElement>
88
89function ReasoningTrigger({
90 children,
91 className,
92 ...props
93}: ReasoningTriggerProps) {
94 const { isOpen, onOpenChange } = useReasoningContext()
95
96 return (
97 <button
98 className={cn("flex cursor-pointer items-center gap-2", className)}
99 onClick={() => onOpenChange(!isOpen)}
100 {...props}
101 >
102 <span className="text-primary">{children}</span>
103 <div
104 className={cn(
105 "transform transition-transform",
106 isOpen ? "rotate-180" : ""
107 )}
108 >
109 <ChevronDownIcon className="size-4" />
110 </div>
111// … truncated

What it pulls in

npm packages

  • lucide-react

Files it writes

  • components/prompt-kit/reasoning.tsx
  • components/prompt-kit/markdown.tsx
  • components/prompt-kit/response-stream.tsx

Facts

Registry
prompt-kit
Type
registry:ui
Access
Free
Files written
3
Licence
NOASSERTION
In the index
at or before 2026-08-10
Last confirmed
3 days ago

Go to the source

agents-ui.github.io agents-ui/agents-kit on GitHub Raw registry item This item as JSON

More from prompt-kit

All 12 items
Same registry, same kind — the ones you would have found next
ComponentRegistryKindAccessInstallsCommand
Chat Containerchat-containerprompt-kitComponentsFree1 dep
Code Blockcode-blockprompt-kitComponentsFree1 dep
File Uploadfile-uploadprompt-kitComponentsFreeno deps
Jsx Previewjsx-previewprompt-kitComponentsFree1 dep
Loaderloaderprompt-kitComponentsFreeno deps
Markdownmarkdownprompt-kitComponentsFree4 deps · 2 files
Messagemessageprompt-kitComponentsFree5 deps · 3 files
Prompt Inputprompt-inputprompt-kitComponentsFreeno deps

Also from Kynth Studios

Built for the same person as BlockDex

SkillWorks

Claude Code skills and plugins, scored

skillworks.kynth.studio

RuleStack

AGENTS.md gallery and agent-config comparison

rulestack.kynth.studio

ToolDrift

What the AI coding tools changed last night

tooldrift.kynth.studio

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex

The studio list

One product, taken apart, once a month

Kynth Studios pulls one shipped product open every month — what it does, what it cost to build, what the pipeline behind it looks like, and what the numbers did. One email a month, nothing in between.

Double opt-in — we send one confirmation link and nothing else until you click it.

BlockDex

Built by

Kynth Studios

the studio behind SkillWorks, RuleStack and ToolDrift

part of Toolproof, the measurement layer for AI agent tooling

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

© 2026 BlockDex. A Kynth Studios product. Changelog

BlockDex