Skip to content

Reasoning

The Reasoning component displays AI reasoning or thinking content in a collapsible format. It automatically tracks streaming duration and can auto-collapse when streaming completes. It’s a compound component with Reasoning.Root, Reasoning.Trigger, and Reasoning.Content.

Variations

Custom thinking message

Customize the thinking message using the getThinkingMessage prop on the trigger.

Installation

import { Reasoning } from '@harnessio/ui/components'
// Basic usage
<Reasoning.Root>
<Reasoning.Trigger />
<Reasoning.Content>
Your reasoning content here...
</Reasoning.Content>
</Reasoning.Root>
// With streaming state
const [isStreaming, setIsStreaming] = useState(true)
<Reasoning.Root isStreaming={isStreaming}>
<Reasoning.Trigger />
<Reasoning.Content>
{streamingContent}
</Reasoning.Content>
</Reasoning.Root>
// Controlled open state
const [open, setOpen] = useState(false)
<Reasoning.Root open={open} onOpenChange={setOpen}>
<Reasoning.Trigger />
<Reasoning.Content>
Controlled content visibility
</Reasoning.Content>
</Reasoning.Root>