Captain UI

Thinking

The agent's reasoning condenses into its label. While it thinks the lines stream under a rippling “Thinking”; when it ends they fold up, bottom line first, into “Thought for 12s”, and pour back out on click.

npx shadcn@latest add https://captain-ui.vercel.app/r/thinking.json

checkout.spec.ts is flaky again. Can you find out why?

…

Usage

import { Thinking } from "@/components/ui/thinking"

<Thinking active={part.state === "streaming"}>{part.text}</Thinking>

Props

PropTypeDefaultWhat it does
activebooleanTrue while the model is still reasoning.
childrenstringThe reasoning so far. It can grow while active.
startedAtnumberEpoch ms when reasoning started, for the timer.
secondsnumberHow long it took, if you already know.
openWhileActivebooleanfalseShow the reasoning as it streams, then fold it into the label when thinking ends.
defaultOpenbooleanfalseStart open.

Keyboard

Enter / Space
Open or close the reasoning

Accessibility

  • A disclosure button with aria-expanded.
  • The label is read once, not letter by letter.
  • Streaming text is a polite live region while open.
  • Under reduced motion the ripple stops and the fold is a plain fade.