Skip to content
pandacoderz/ui

Reasoning

Collapsible thinking block that opens while streaming and reports elapsed time when done.

Installation

npx shadcn@latest add https://ui.spencerwueste.com/r/reasoning.json

Usage

import {
  Reasoning,
  ReasoningContent,
  ReasoningTrigger,
} from "@/components/pandacoderz-ui/reasoning";
<Reasoning isStreaming={isThinking}>
  <ReasoningTrigger />
  <ReasoningContent>{reasoningMarkdown}</ReasoningContent>
</Reasoning>

While isStreaming is true the block stays open and the label shimmers. When it flips to false the block collapses and the label becomes “Thought for N seconds”.

API Reference

Reasoning

Prop Type Description
isStreaming boolean Whether reasoning tokens are still arriving.
open boolean Controlled open state.
defaultOpen boolean Initial open state when uncontrolled.
onOpenChange (open: boolean) => void Open state callback.

ReasoningTrigger

Renders the default label unless you pass children.

ReasoningContent

Prop Type Description
children string Markdown text. Rendered with Streamdown.