Reasoning

A component for displaying collapsible reasoning or thought process content, perfect for AI applications that need to show their "thinking" or step-by-step explanations.

Examples

Basic Usage

The most basic implementation of the Reasoning component with collapsible content.

I calculated the best color balance

With AI Response

Combine with the ResponseStream component to show streaming AI reasoning content.

The square root of 144 is 12.

Controlled Component

Control the open state programmatically for advanced use cases.

The result of the calculation is 256.

State: Closed

Custom Styling

Customize the appearance of the Reasoning component to match your application's design. You can also use markdown in the ReasoningResponse component to style the content.

The most efficient algorithm for this problem is Quick Sort, with O(n log n) time complexity.

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

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
...propsHTMLAttributesAdditional HTML div props

ReasoningResponse

PropTypeDefaultDescription
textstring | AsyncIterable<string>The text to display or stream
classNamestringAdditional CSS classes
...propsResponseStreamPropsAdditional ResponseStream props (except textStream)