Reasoning
Reasoning tucks the model's thinking into a collapsible block: “Reasoning…” with a timer while it runs, “Reasoned for 12s” when done.
Import
Install from npm, copy the source into your project with @yugen-ui/cli or the shadcn CLI, or import directly when working in this repo.
// npm install yugen-uiimport { Reasoning } from "yugen-ui";Variants
Each tile is a standalone example: hover to copy, or press Code to see the source.
Compared 3 ways to store tokens: CSS variables, JSON, TS. Picked CSS variables because switching themes needs no rebuild.
Finished, with duration
Collapsed by default; pass duration when the server has already measured it.
Usage
- Place Reasoning right above the answer and collapse it once done.
- Show the reasoning time so people understand why they had to wait.
- Let people reopen it to check the reasoning.
- Don't leave a long reasoning block open once the answer is there.
- Don't use Reasoning for tool-call steps. Use Trace.
- Don't read the reasoning content through a live region.
Props
| Prop · Type | Default | Description |
|---|---|---|
| streamingboolean | Default: false | Reasoning in progress: changing label, timer, aria-busy. |
| durationnumber (ms) | Default: — | Duration; measured automatically when left out. |
| open / defaultOpen / onOpenChangeboolean | Default: — | Controls the open state. |
| autoOpenboolean | Default: true | Opens when reasoning starts and collapses when it ends. |
| labelReactNode | Default: — | Replaces the default label. |
| childrenstring | ReactNode | Default: — | A string is rendered with StreamingMarkdown size small. |
Messages
Text built into the component: labels, aria-labels, screen reader announcements.
English by default. Change it with the messages prop of YugenProvider, by the namespace below; messagesVi has the Vietnamese set. See Interface language.
messages.reasoning
| Key · Type | Default (English) | messagesVi |
|---|---|---|
| thinkingstring | Default (English)"Thinking…" | messagesVi"Đang suy luận…" |
| thoughtstring Đã xong, không rõ thời lượng. | Default (English)"Thought" | messagesVi"Đã suy luận" |
| thoughtFor(duration: string) => string Đã xong; | Default (English)(duration) => `Thought for ${duration}` | messagesVi(duration) => `Đã suy luận trong ${duration}` |