Reasoning

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.

Examples

Basic Usage

The most basic implementation of the Reasoning component with auto-close functionality when streaming ends.

With Markdown

Show rich formatting with markdown support for better structured reasoning content.

Installation

npx shadcn add "https://prompt-kit.com/c/reasoning.json"

Component API

Reasoning

PropTypeDefaultDescription
childrenReact.ReactNodeThe content of the component
classNamestringAdditional CSS classes
openbooleanControl the open state (makes component controlled)
onOpenChange(open: boolean) => voidCallback when open state changes
isStreamingbooleanWhen false, automatically closes the reasoning (auto-close)

ReasoningTrigger

PropTypeDefaultDescription
childrenReact.ReactNodeThe content of the trigger
classNamestringAdditional CSS classes
...propsHTMLAttributesAdditional HTML button props

ReasoningContent

PropTypeDefaultDescription
childrenReact.ReactNodeThe content to be displayed
classNamestringAdditional CSS classes
contentClassNamestringAdditional CSS classes for the content
markdownbooleanfalseEnable markdown rendering for the content
...propsHTMLAttributesAdditional HTML div props