Skip to main content

Chat

ThinkingBlock

An agent's reasoning before its reply: open while it streams in, then closed to one quiet line, "Thought for 12 seconds", that the person can open again. Once the person opens or closes it, their choice holds. It is a Collapsible, so the title is a 44px row on touch screens and the closed reasoning is found by the browser's page search.

The person wants a dinner for six that one oven can finish at once. The roast needs the oven at 200°C for an hour, so the sides have to share that heat or cook on the stove.

Install

Hand it to your agent
Add ThinkingBlock from Ouro UI to this app. Read https://ui.ouroboros.bot/docs/thinking-block.md first and follow it.

Or by hand. Once per app, with Tailwind CSS v4 and an @/* path alias (Ouro HX is built on Base UI, so --base base; skip -t in an existing app):

npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823

Then the component (Installing):

npx shadcn@latest add ourostack/ouro-ui/thinking-block#v1.3.823
import { ThinkingBlock } from "@/components/ouro/thinking-block/thinking-block";

Paths use shadcn's default @/ alias; the CLI rewrites them to yours.

Example

<ThinkingBlock streaming={!done} duration={seconds}>
  {reasoning}
</ThinkingBlock>

Use instead when

  • Use Collapsible instead for a section that isn't an agent's reasoning, and TypingIndicator instead to say an agent is writing before any reasoning arrives.

Props

Type: ThinkingBlockProps.

children (required)
Type: ReactNode
The agent's reasoning, as it streams in. A string keeps its line breaks.
className
Type: string
Layout only: margins, width (mt-2). Appearance classes warn in development.
defaultOpen
Type: boolean
Opens it first and keeps it open after the reasoning ends, until the person closes it.
duration
Type: number
How long the agent thought, in seconds, for the finished title: "Thought for 12 seconds".
onOpenChange
Type: ((open: boolean) => void)
Called with the new state when the person opens or closes it.
open
Type: boolean
Whether it is open, when you control it. Pair it with onOpenChange.
ref
Type: Ref<HTMLDivElement>
Reaches the rendered element.
streaming
Type: boolean
Whether the reasoning is still coming in. While it is, the block is open, its title says "Thinking" beside a spinner, and the reasoning is marked busy; when it ends, the block closes to its finished title.
summary
Type: ReactNode
The finished title in place of "Thought for 12 seconds", such as the agent's own summary: "Checked the ratios".

Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

  • content: Not a prop. The reasoning is the children: <ThinkingBlock>{reasoning}</ThinkingBlock>.
  • isOpen: Not a prop. Ouro UI uses open: <ThinkingBlock open>.
  • isStreaming: Not a prop. Ouro UI uses streaming: <ThinkingBlock streaming>.
  • loading: Not a prop. Ouro UI uses streaming: <ThinkingBlock streaming>.
  • title: Not a prop. The finished title is summary: <ThinkingBlock summary="Checked the ratios">.

className is for layout only

Pass margins, width and grid placement (mt-4, w-full, col-span-2).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (hover:, sm:) and any ! are removed, it starts with bg-, text-, border-, rounded-, shadow-, font-, ring-, from-, via-, to-, fill- or stroke-, or is border, rounded, shadow or ring, or has a dark: variant. Text wrapping, overflow and table layout classes (text-wrap, text-ellipsis, border-collapse) are layout and do not warn.

Alignment classes (text-center) warn too: set alignment on a parent element.