Reasoning Text

Shimmering reasoning lines that cascade, swap or scramble between steps.

Preview

"use client";

import {
  ReasoningText,
  type ReasoningTextVariant,
} from "@/components/agents/loading-states/reasoning-text";

const EXAMPLES: {
  label: string;
  variant: ReasoningTextVariant;
  phrases: string[];
}[] = [
  {
    label: "Cascade",
    variant: "cascade",
    phrases: [
      "Thinking",
      "Reading the request",
      "Working through the details",
      "Preparing the answer",
    ],
  },
  {
    label: "Swap",
    variant: "swap",
    phrases: [
      "Thinking",
      "Reading the request",
      "Working through the details",
      "Preparing the answer",
    ],
  },
  {
    label: "Scramble",
    variant: "scramble",
    phrases: ["Thinking", "Searching", "Reasoning", "Composing"],
  },
];

export function ReasoningTextPreview() {
  return (
    <div className="grid w-full max-w-sm gap-7">
      {EXAMPLES.map(({ label, variant, phrases }) => (
        <div key={variant} className="grid gap-2">
          <span className="text-[11px] font-medium uppercase tracking-wider text-muted-foreground/60">
            {label}
          </span>
          <ReasoningText
            variant={variant}
            phrases={phrases}
            className="text-base"
          />
        </div>
      ))}
    </div>
  );
}

Install

Add it with the shadcn CLI, or copy the source manually.

$ bunx --bun shadcn add @beui/reasoning-text

API Reference

phrases?
string[]

Phrases cycled through while the agent works.

Default—
variant?
"cascade" | "swap" | "scramble"

Animation used when the active phrase changes.

Defaultcascade
interval?
number

Milliseconds each phrase remains visible.

Default1800
shimmerDuration?
number

Seconds taken for one shimmer pass.

Default2.2
indicator?
ReactNode

Optional leading visual. Defaults to a terminal-style ASCII loader.

Default—
labels?
Partial<{ thinking: string; churning: string; inProgress: string; reasoning: string; phraseThinking: string; phraseReading: string; phraseConnecting: string; phraseForming: string; }>

Override any built-in string, including the default phrases.

Default—
className?
string

Classes merged onto the root element.

Default—
Also on React Native. Shimmers, cycling reasoning text and a progress timer.

More in Agent Loading States

Updated