Thinking Indicator
AI loading state with a fluid morphing sparkle glyph and cycling status words that slide through a soft blur with a shimmer sweep.
Thinking Indicator
AI loading state with a fluid morphing sparkle glyph and cycling status words that slide through a soft blur with a shimmer sweep.
The sparkle condenses into a circle and re-forms while the status word cycles underneath — a self-timing, theme-aware loading row for streamed replies.
Installation
Install the component with the Craft-UI Blocks CLI — it drops thinking-indicator.tsx into your project and wires up its runtime dependencies:
npx mvpblocks add thinking-indicatorpnpm dlx mvpblocks add thinking-indicatoryarn dlx mvpblocks add thinking-indicatorbunx mvpblocks add thinking-indicatorFile Structure
The CLI saves the component to your project's components/ui folder:
Import it from @/components/ui/thinking-indicator.
Usage
import { ThinkingIndicator } from "@/components/ui/thinking-indicator";
export function ChatPending() {
return (
<ThinkingIndicator
className="font-medium text-sm"
words={["Thinking", "Reasoning", "Planning", "Refining"]}
/>
);
}Theming
No hardcoded palette anywhere — the indicator is drawn entirely from theme tokens, so it inherits your light and dark themes exactly. The wrapper sits on text-muted-foreground with a flex items-center gap-[0.6em] row, everything sized in em so the whole indicator scales with whatever font-size the consumer sets. The glyph is a 1.5em SVG painted with a currentColor linear gradient (opacity ramping 1 → 0.4), so it picks up the muted foreground automatically, with a small companion star at opacity 0.5. The cycling label layers two backgrounds: the resting text is --ti-base: var(--muted-foreground) and the sweeping sheen is --ti-sheen: var(--foreground) — both CSS variables bound to theme tokens, reading correctly in light and dark alike.
Animations
- Liquid glyph morph: all four paths share the same
M + 4 cubic curves + Zcommand structure so Motion interpolates thedattribute as one continuous morph —sparkle → blobA → circle → blobB → sparkleon a shared 4s timeline (times: [0, 0.3, 0.5, 0.7, 1]). A breathing scale ([1, 0.9, 0.78, 0.9, 1]) and a constant linear 360° rotation ride the same timeline. The two blobs are deliberately asymmetric, so the morph wobbles like a droplet instead of collapsing on a straight line to the circle. - Twinkle companion: the small top-right star blooms at exactly the cycle midpoint —
opacity [0,0,1,0,0],scale [0.2,0.5,1,0.5,0.2], spinning to 180° — timed precisely when the main glyph has condensed into the circle. - Word slider: each word enters through a soft blur with an
AnimatePresence popLayoutcrossfade — new word slides up fromy: 70%withblur(3px) → blur(0), spring-weighted (stiffness 420, damping 34), opacity and filter easing over0.28soncubic-bezier(0.4, 0, 0.2, 1); the outgoing word exits up aty: -70%with the blur returning over0.2s. - Shimmer sweep: a sheen band sweeps left across the word on a repeating
2slinear background-position loop. The gradient spread is computed per word —--ti-spread: word.length * 2px— so the highlight hugs the text's width. An invisible copy of the longest word reserves the column, so the layout never shifts as words of different lengths cycle through. - Reduced motion:
useReducedMotiondisables the morph, the shimmer sweep, and the cycling — you get a static sparkle with a pinned label, same meaning without movement. - Accessibility: the root is a
role="status"live region with ansr-onlyannouncement of the first word; the moving display isaria-hiddenso screen readers hear one announcement instead of one per cycle.
Props
ThinkingIndicator
Prop
Type
Registry Bundle
Install the exact registry entry shown on the right when you want the component file and its declared runtime dependencies together. Dependencies: motion.
Contact
If you find any bug or issue, feel free to raise an issue.
Last updated on