Reasoning

A React component in Beamline's AI & agents category, in the free sample.

The agent's trace, fed by your stream: a shimmering label and the seconds so far while it works, then "Thought for N seconds"; steps that check off, prose thoughts, search sources or tool calls, open while running and folded when done.

Use it for

  • Showing what an agent did while thinking: steps, searches, code, collapsible afterwards.

Not for

  • The answer itself (response).
  • Tool calls with inputs and outputs to inspect (tool-call).
  • A plan that needs approval (plan).

Anatomy

  • header button: glyph, label (shimmer while running), seconds, chevron
  • trace (ordered list with a guide line)
  • query row (search)
  • rows: step check or spinner / source glyph and link / prose / tool with +/− lines; a row short of room cuts its secondary first (a source's host folds away under 20rem), the full text on hover
  • +N more
  • polite announcement when a run finishes
  • room: up to 32rem wide; a size container

Variants

  • variant: steps, reasoning, search, coding

States

  • running (open, shimmer, elapsed seconds)
  • done (folded, "Thought for N seconds" or doneLabel)
  • opened or closed by the person (kept until a new run)
  • controlled (open / onOpenChange)

Keyboard

  • Enter/Space on the header toggles the trace (aria-expanded)
  • Closed traces are out of the Tab order
  • Search rows are links

Motion

The label shimmers while running (still under reduced motion) and its seconds roll as they tick (SlotText); the trace opens on --pui-motion-in and folds on --pui-motion-out (disclosure-panel); a step that arrives while it runs grows to its height (enter-grow, --pui-duration-morph) and rises in once (enter-rise), so the content below glides, while history rows mounted with the trace stay still; the label eases to each new width (useWidthMorph) so the chevron glides instead of jumping, and a run that ended here fades to its settled label.

Props

PropTypeDefaultDescription
rows (required)ReasoningRow[]—Reasoning steps, prose, sources or tool calls displayed in order. Required.
variant"steps" | "reasoning" | "search" | "coding"—Legacy mode setting; omitted by default. Deprecated: Use mode instead.
status"running" | "done"—`running` says the label in a shimmer and spins the last step; `done` settles and folds the trace.
activeLabel / doneLabel / startedAtstring / string / number—activeLabel: Header while running, e.g. "Thinking", "Searching the web". doneLabel: Header once done. Defaults to "Thought for N seconds", timed from when the run started. startedAt: When the run started (ms since epoch). Defaults to the moment `status` first became `running`.
query / more / iconstring / number / ReactNode—query: Search query shown above search rows. more: Count of further rows not listed ("+7 more"). icon: Header glyph; defaults to a brain.
open / defaultOpen / onOpenChangeboolean—open: The trace open, controlled or not. Uncontrolled it is open while running and folds when done, until the person toggles it. defaultOpen: Initial expansion override; omitted by default to open while running and fold after completion. onOpenChange: Reports open state after a change; no callback by default.
style / refCSSProperties / native Ref—style: Inline styles on the documented visual root; no inline overrides by default. ref: Receives the documented root element; no ref by default.
classNamesReasoningClassNames—Classes for the named visual parts; no part overrides by default.
modeReasoningVariant—Shows steps, prose reasoning, search sources or coding calls; defaults to steps.
styleCSSProperties—Inline styles on the documented visual root; no inline overrides by default.
refRef<HTMLDivElement>—Receives the documented root element; no ref by default.
activeLabelstring—Header while running, e.g. "Thinking", "Searching the web".
doneLabelstring—Header once done. Defaults to "Thought for N seconds", timed from when the run started.
startedAtnumber—When the run started (ms since epoch). Defaults to the moment `status` first became `running`.
querystring—Search query shown above search rows.
morenumber—Count of further rows not listed ("+7 more").
openboolean—The trace open, controlled or not. Uncontrolled it is open while running and folds when done, until the person toggles it.
defaultOpenboolean—Initial expansion override; omitted by default to open while running and fold after completion.
onOpenChange((open: boolean) => void)—Reports open state after a change; no callback by default.
iconReactNode—Header glyph; defaults to a brain.
classNamestring—Classes on the documented visual root; no override by default.
summaryReactNode—What a finished, folded trace says after its label, so the line tells what happened without opening it ("ran 5 tests, 1 failed"). Defaults to a count of its insides: steps, sources, or tool calls with the lines they added and removed; prose has none. `false` shows nothing. Hidden while open, where the trace speaks for itself.

Built from

Used in

Dependencies

lucide-react

Import

import { Reasoning } from "@beamline/reasoning";

Get it

Reasoning is part of Beamline UI. Install the parts you need in your React app as compiled packages or editable source. Reasoning is included in the free MIT sample. Get Beamline · Connect your agent

More in AI & agents

  • Image generation: The frame an AI image is generated into: a field of brand-hued pixels breathes with the progress while the model works, then the image arrives —…
  • Flowchart: A workflow as steps on a dotted canvas: a trigger, conditions that branch into paths side by side, actions and waits, read top to bottom; during a run…
  • Run trace: One agent run as a waterfall: every step (model calls, tools, retrieval, checks, sub-agents) nested under the step that started it, each a bar on a…
  • Run theatre: One agent run as a theatre: the Run trace's waterfall under a transport (play, scrub, speed) that replays the run as it happened. Pick a step and re-run…
  • Answer compare: Two answers to the same prompt side by side, and a person's verdict: A is better, a tie, B is better, or both are bad, with the reasons that decided it…
  • Branch navigator: The versions of an assistant conversation that forked when a message was edited or an answer regenerated: a “‹ 2 / 3 ›” switch on each message that has…
  • Response: An assistant's answer as streamed markdown in the system's reading type: bursty tokens flow in at an even pace, each new word fades in through a short…
  • Chat thread: People talking to people: messages grouped by person and day, reactions, delivery and read receipts that glide to the newest message read, who is typing…
  • Model picker: Choose the AI model for a request by what it can do and what it costs: a trigger with the model's name opens a searchable list grouped by provider, with…
  • Task rows: Background work an agent is doing, one row per task: status as a glyph and a word, what it produced, how long it has run or took, a progress bar while…
  • Conversation: The scrolling column of a conversation: follows new content while you are at the bottom, stops when you scroll up to read, and offers a way back; shared…
  • Context cards: The knowledge an agent retrieved before it answered: one card per chunk with what it is about, the text it read with the search words marked, how…
  • Prompt suggestions: Ready-made prompts a person can start from or follow up with: chips, cards or a list; a picked one lifts off and flies into the composer as its text…
  • Plan: An agent's plan: numbered steps with live status, progress, and Approve / Edit / Reject when it needs sign-off; approving shows progress, and a refusal…
  • Approval card: The agent stops and asks before it acts: what it wants to do, exactly what that changes, any choices it needs, and Approve or Reject; both run your…
  • Tool call: One tool call in an agent's run: status, what it did and a short result on one quiet row that opens to the exact input and output; stops for permission…
  • Recommendation card: One suggestion from the agent that the person may take or leave: what it suggests, why, the expected effect and how sure it is (a meter and a word…
  • Citations: Inline numbered citations that preview their source on hover or focus, plus a numbered source list; streamed answers flow in at an even pace with the…
  • Attachment: A file tile: preview or typed glyph with the type named, name, size, upload progress, error with retry, and a keyboard-reachable remove.
  • Prompt bar: The agent composer: a field that grows, @ to add a source, / for a command, a model picker, files and dictation, and one button that sends with progress…
  • Selection actions: Select a passage and hand it to the agent: a bar over the selection with quick actions, your own instruction and More; while the agent works it says so…
  • Message: One turn in a conversation with an agent: the person's words in a quiet bubble, the agent's answer on the page with its orb mark, trace, tool calls and…

Read next: Build an AI interface

Guides: Build an AI agent interface in React

Compared in: shadcn/ui alternatives for finished React app screens

Part of Beamline UI: polished, editable React components and complete screens for custom applications. Build your own style from any look; tokens, fonts, radii, motion; not only colours.