suiss/ui · AI
Reasoning
A line for the agent's thinking that opens while the model thinks and closes when it is done.
Reasoning is a line for the agent's thinking. It reads "Thinking" and opens while the model thinks, then reads "Thought" and closes when it is done. The thinking sits inside, and the line can show how long it took.
It is built with Trace: a TraceCollapsible whose content is the reasoning text. For the steps that follow, see Chain of Thought.
Installation
Reasoning is built with Trace.
Or use the suiss/ui CLI:
Usage
Set whitespace-pre-wrap on the content so paragraph breaks in the reasoning text are kept.
Examples
Duration
Shows how long the model thought in a TraceDescription after the title. Measure it on the server and send it with the message.
AI SDK
Render each reasoning part as a line. It starts as a plain TraceLine and becomes a TraceCollapsible once text arrives, so there is nothing to open before the model has written anything. It opens while the model thinks and closes when it finishes; once the reader opens or closes it, their choice wins.
Some models send several reasoning parts in one message. Each one is a line in the same Trace.
With React Aria, pass isExpanded and onExpandedChange instead of open and onOpenChange.
API Reference
See Trace.
Accessibility
- The line is a button with
aria-expandedonce there is text to show. - The running shimmer stops when the reader prefers reduced motion; the title still says "Thinking".