Reasoning Steps

AI reasoning trace with a shimmering trigger label, a self-timing readout, and a connected step timeline.

Reasoning Steps

AI reasoning trace with a shimmering trigger label, a self-timing readout, and a connected step timeline.

Watch the trigger while the active step is in flight — the label sweeps with a shimmer, the elapsed-seconds readout ticks up on its own, and the collapsed preview line slides between step names. Click it to open the connected step timeline; the connector line disappears automatically after the final rendered step.

Installation

Install the component with the Craft-UI Blocks CLI — it drops reasoning-steps.tsx into your project and wires up its runtime dependencies:

npx mvpblocks add reasoning-steps
pnpm dlx mvpblocks add reasoning-steps
yarn dlx mvpblocks add reasoning-steps
bunx mvpblocks add reasoning-steps

File Structure

The CLI saves the component to your project's components/ui folder:

Import it from @/components/ui/reasoning-steps.

Usage

Compose a ReasoningStepsTrigger and a ReasoningStepsContent inside the root, then lay the reasoning trace out as ReasoningStep rows — nesting details and source pills under any step you want to expand:

import {
  ReasoningStep,
  ReasoningStepDetails,
  ReasoningStepSource,
  ReasoningStepSources,
  ReasoningSteps,
  ReasoningStepsContent,
  ReasoningStepsTrigger,
} from "@/components/ui/reasoning-steps";

export function AssistantReply() {
  return (
    <ReasoningSteps>
      <ReasoningStepsTrigger>Reasoning</ReasoningStepsTrigger>
      <ReasoningStepsContent>
        <ReasoningStep
          description="Parsing the question and pulling out the actual constraints."
          label="Reading the request"
          status="done"
        />
        <ReasoningStep
          description="Checking the deploy config mentioned earlier in the thread."
          label="Recalling relevant context"
          status="done"
        />
        <ReasoningStep
          description="A quick rollback versus a targeted env-var fix."
          label="Weighing two approaches"
          status="done"
        >
          <ReasoningStepDetails summary="See the tradeoffs">
            A rollback restores service in under a minute but loses the
            config fix for the next deploy. The env-var patch takes longer
            to verify but fixes it at the source.
          </ReasoningStepDetails>
          <ReasoningStepSources>
            <ReasoningStepSource>vercel.com/docs</ReasoningStepSource>
            <ReasoningStepSource>runbook.md</ReasoningStepSource>
          </ReasoningStepSources>
        </ReasoningStep>
        <ReasoningStep
          description="Writing the fix as a short, ordered checklist."
          label="Drafting the answer"
          status="active"
        />
      </ReasoningStepsContent>
    </ReasoningSteps>
  );
}

Theming

The trace is drawn entirely from theme tokens, so it matches your app in light and dark mode with no configuration. The card is bg-card in the app's rounded-2xl surface; step labels read as text-foreground (stepping up to text-foreground/80 once a step is done), descriptions and the trigger preview are text-muted-foreground, and the duration readout uses text-muted-foreground tabular-nums so the ticking seconds never jitter. The shimmer sweep is clipped to the label text itself and built from --muted-foreground and --foreground stops, so it inherits your palette without any extra colors, settling to plain text once nothing is in flight. Glyphs are text-foreground, connectors are bg-foreground/25 after a step completes and bg-foreground/10 while a step is active, and source pills sit on bg-muted/60 with a border-foreground/10 edge (brightening on hover when they link out). Everything inverts automatically with your theme.

Animations

  • Trigger: pressing the pill scales it to 96% on a snappy spring; while any step is active, the label runs a looping gradient sweep clipped to the text and the readout self-times — the clock keeps a running total across separate active bursts instead of restarting each time.
  • Step rows: each row springs in with a measured-height expand (the panel measures its natural height with a ResizeObserver rather than animating to Motion's "auto", so the spring never overshoots under a scaled ancestor). The connector line under a step is only drawn between rendered steps — it hides on whichever step ends up last, with no isLast bookkeeping.
  • Glyph: the active dot pops into a check through an AnimatePresence wait-swap when a step completes.
  • Trigger preview: while collapsed, a preview line beneath the label slides up and blurs out as the active step changes, so the current step stays visible without opening the panel.
  • Sources and images: source pills blur and scale in as they mount (rendering as a link when given an href), and attached images fade in with a blur settle and an optional caption.
  • Open/close: the disclosure expands and collapses on two tuned springs and only applies hidden once the collapse has visually finished, so the exit never cuts off mid-animation.
  • Reduced motion: every transition swaps to an instant state change under prefers-reduced-motion.

Props

ReasoningSteps

Prop

Type

ReasoningStep

Prop

Type

ReasoningStepDetails

Prop

Type

ReasoningStepsTrigger

The disclosure row: just the label and the elapsed-seconds readout — no status icon and no chevron. children defaults to "Reasoning".

No icon runs next to the label. Instead, the label itself gets a looping shimmer sweep clipped to the text while any step is active, and settles to plain text once nothing is in flight.

While collapsed, a small preview line beneath the label slides and blurs between step labels as the active step changes, so the current step stays visible without opening the panel.

ReasoningStepsContent

The panel: renders its ReasoningStep children in a ul and measures its own natural height with a ResizeObserver instead of animating to Motion's "auto", so the spring never overshoots under a scaled ancestor.

The connecting line under a step is only drawn between rendered steps — it's hidden automatically on whichever step ends up last, with no isLast bookkeeping required from the consumer.

ReasoningStepSources, ReasoningStepSource, ReasoningStepImage

Optional citation and attachment parts for a step. Sources wraps a row of Source pills in a flex-wrap container; each Source blurs and scales in and renders as a link when given href. Image blurs in an attached screenshot or diagram with an optional caption.

ReasoningStepSource renders an anchor when href is passed (opened in a new tab) and a plain span otherwise.

Registry Bundle

Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together. Dependencies: @base-ui/react, motion, lucide-react.

Contact

If you find any bug or issue, feel free to raise an issue.

Last updated on