<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# 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.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

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

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { ThinkingBlock } from "@/components/ouro/thinking-block/thinking-block";
```

## Example

```tsx
<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`.

| Prop | Type | Description |
| --- | --- | --- |
| `children` (required) | `ReactNode` | The agent's reasoning, as it streams in. A string keeps its line breaks. |
| `className` | `string` | Layout only: margins, width (`mt-2`). Appearance classes warn in development. |
| `defaultOpen` | `boolean` | Opens it first and keeps it open after the reasoning ends, until the person closes it. |
| `duration` | `number` | How long the agent thought, in seconds, for the finished title: "Thought for 12 seconds". |
| `onOpenChange` | `((open: boolean) => void)` | Called with the new state when the person opens or closes it. |
| `open` | `boolean` | Whether it is open, when you control it. Pair it with `onOpenChange`. |
| `ref` | `Ref<HTMLDivElement>` | Reaches the rendered element. |
| `streaming` | `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` | `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.
