Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Add accessible animated AI loading and agent-status indicators with the React thinking-orbs library. Use when a chat, copilot, voice, search, generation, or tool-running interface needs a semantic working, searching, solving, listening, composing, or shaping state; when replacing a generic spinner with an AI activity orb; or when implementing the library's size, theme, speed, pause, reduced-motion, and canvas behavior.
| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 72% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 28% | 0% |
| case-03 | ✗→✓ | ▲ Improved | -24% | 0% |
| case-04 | ✗→✓ | ▲ Improved | -33% | 0% |
| case-05 | ✗→✓ | ▲ Improved | 50% | 0% |
thinking-orbs in React 18+ interfaces that need indeterminate AI activity feedback.20 or 64 pixel size. Do not stretch one preset into another.theme="auto" unless the surrounding surface has a known fixed theme.aria-label with a task-specific label, or hide the orb from assistive technology when adjacent live text already announces the same state.paused to freeze the current frame. Do not simulate pause with speed={0}.The package renders monochrome dots on a transparent 2D canvas. It does not expose custom colors, arbitrary sizes, or determinate progress.
Inspect the project package manager, then install:
bashnpm install thinking-orbs
The package declares react and react-dom version 18 or newer as peer dependencies. Import the component and exported types from the package root:
tsximport { ThinkingOrb, type OrbSize, type OrbState, type OrbTheme, type ThinkingOrbProps, } from "thinking-orbs";
working — generic tool execution, multi-step work, or an activity without a more precise state.searching — retrieval, web search, file search, or knowledge lookup.solving — reasoning, analysis, calculation, or planning.listening — microphone input, speech capture, or waiting for a spoken turn.composing — writing, summarizing, drafting, or generating a text response.shaping — creating or refining an image, layout, structured artifact, or other formed output.Prefer a truthful generic working state over a visually interesting but inaccurate state. Change the state only when the underlying activity changes.
size={20} inline with text, inside buttons, or in compact status rows.size={64} at chat-avatar scale, in an empty state, or as the main visual status.The presets have different dot counts, dot sizes, and speed tuning. They are separate designs rather than a scale factor. If the layout needs more surrounding space, size the wrapper instead of applying CSS transforms to the canvas.
tsximport { ThinkingOrb } from "thinking-orbs"; export function AgentStatus() { return ( <ThinkingOrb state="searching" size={20} theme="auto" aria-label="Searching project files…" /> ); }
All other canvas props pass through, including className, style, data-*, event handlers, and ARIA attributes.
Keep product phases separate from visual states so the mapping stays explicit:
tsximport { ThinkingOrb, type OrbState } from "thinking-orbs"; type AgentPhase = | "idle" | "retrieving" | "reasoning" | "writing" | "creating" | "done" | "error"; const ORB_BY_PHASE: Partial<Record<AgentPhase, OrbState>> = { retrieving: "searching", reasoning: "solving", writing: "composing", creating: "shaping", }; export function AgentActivity({ phase }: { phase: AgentPhase }) { const state = ORB_BY_PHASE[phase]; if (!state) return null; return <ThinkingOrb state={state} size={20} />; }
Remove the orb on done, error, cancellation, or idle. Show the appropriate result, retry, or error UI instead of leaving the last activity animation running.
The component defaults to role="img" with a per-state label such as “Searching…”. When visible text describes the same state, make the text the single announcement source:
tsxexport function LiveAgentStatus() { return ( <div role="status" aria-live="polite" className="agent-status"> <ThinkingOrb state="solving" size={20} aria-hidden="true" /> <span>Reviewing the repository…</span> </div> ); }
Use aria-live="polite" for ordinary phase changes. Avoid rapid label churn. Do not add another hidden live region when role="status" already owns the announcement.
Use one of:
tsx<ThinkingOrb theme="auto" /> <ThinkingOrb theme="dark" /> <ThinkingOrb theme="light" />
auto first checks an ancestor data-theme="dark|light" attribute or dark / light class.auto follows prefers-color-scheme.dark means light dots intended for a dark background.light means dark dots intended for a light background.The canvas is transparent. Verify contrast against the actual surface rather than the page root alone.
tsx<ThinkingOrb state="working" speed={0.85} /> <ThinkingOrb state="composing" paused={isWaitingForApproval} />
speed multiplies the baked speed of the selected state and size. Start at 1; use roughly 0.75–1.25 for subtle product tuning. Extreme values can make the hand-tuned motion feel frantic or stalled.
paused freezes the current frame while retaining the visual status. Remove the component when the activity has actually ended.
The component uses React effects, canvas, requestAnimationFrame, media queries, and observers. Keep the package import behind a client boundary in the Next.js App Router:
tsx"use client"; import { ThinkingOrb } from "thinking-orbs"; export function ThinkingStatus() { return <ThinkingOrb state="working" size={20} />; }
The library is SSR-safe because it paints only on the client after resolving the theme. A client boundary is still required where the framework enforces server and client component separation.
2.requestAnimationFrame loop per visible instance.performance.now() clock so multiple orbs stay in phase.IntersectionObserver.prefers-reduced-motion: reduce.Do not rebuild these behaviors in a wrapper. Add product state management and layout around the component, not a second animation loop.
Prefer <ThinkingOrb> for product UI. The package also exports its resolved presets and raw frame painters for a custom canvas outside React:
tsimport { MODE_DRAWS, resolvePreset } from "thinking-orbs"; const { mode, speed, opts } = resolvePreset("searching", 64); const drawFrame = MODE_DRAWS[mode]; drawFrame( context, 64, (performance.now() / 1000) * speed, true, // true draws light ink for a dark surface opts, );
STATE_TO_MODE exposes the internal mapping:
working → orbitssearching → globesolving → rubiklistening → wavecomposing → ribbonshaping → morphUse the raw API only when another renderer owns the canvas lifecycle. It provides a frame painter, not component behavior. Reimplement DPR sizing, clearing, animation scheduling, pausing, theme resolution, reduced motion, visibility handling, cleanup, and accessibility when bypassing <ThinkingOrb>.
Run the project's typecheck, tests, production build, and git diff --check. Then verify in a real browser:
20 and 64 pixel instances are crisp without CSS scaling.20 or 64; do not pass arbitrary dimensions.dark targets dark backgrounds and therefore draws light ink.role="status" text already announces the task.searching during generation or composing during microphone capture.Report the mapped product phases, chosen size, theme mode, accessible label strategy, reduced-motion behavior, and build/browser verification. Distinguish local implementation from a deployed release.
Other measured skills in the registry, with their headline benchmark lift.