Reasoning
Preview

Collapsible reasoning disclosure for AI thinking text.

Overview

Reasoning displays model reasoning or thinking text behind a collapsible trigger. Consumers own the text, streaming status, and persistence.

The trigger shows active thinking with isStreaming, auto-opens when reasoning starts, and auto-closes after reasoning finishes.

Usage

import {
  Reasoning,
  ReasoningContent,
  ReasoningTrigger,
} from "@tilt-legal/cubitt-components/chat-elements";

Examples

Default

Streaming

API Reference

Reasoning

Root collapsible container for reasoning text. Extends Collapsible props.

PropTypeDefaultDescription
isStreamingbooleanfalseMarks reasoning as actively streaming. Auto-opens the disclosure when streaming starts.
openboolean-Controlled open state.
defaultOpenbooleanisStreamingInitial open state when uncontrolled. Pass false to opt out of auto-open.
onOpenChange(open: boolean) => void-Callback fired when the disclosure opens or closes.
durationnumber-Controlled thinking duration in seconds. If omitted, duration is measured from streaming time.
childrenReact.ReactNode-Reasoning trigger and content.
classNamestring-Additional CSS classes for the root collapsible.

ReasoningTrigger

Trigger for the reasoning disclosure. Extends CollapsibleTrigger props.

PropTypeDefaultDescription
getThinkingMessage(isStreaming: boolean, duration?: number) => ReactNode-Custom renderer for the default trigger label.
childrenReact.ReactNode-Custom trigger content. Replaces the default thinking label and chevron.
classNamestring-Additional CSS classes for the trigger.

The default trigger shows a shimmer while streaming, then displays the measured thinking duration when available.

ReasoningContent

Collapsible panel that renders reasoning markdown through Streamdown.

PropTypeDefaultDescription
childrenstring-Reasoning markdown text. Required.
classNamestring-Additional CSS classes for the collapsible panel.

useReasoning

Hook for custom reasoning subcomponents. Must be called within Reasoning.

FieldTypeDescription
isStreamingbooleanWhether the current reasoning block is streaming.
isOpenbooleanCurrent open state.
setIsOpen(open: boolean) => voidUpdates the open state and calls onOpenChange.
durationnumber | undefinedCurrent thinking duration in seconds.

On this page