Thinking indicator
Show that an agent is working before its response begins.
import { ThinkingIndicator } from '@uthereal/ui/thinking-indicator'Thinking indicator playground
Overview
ThinkingIndicator signals active agent work before response text arrives. It renders either a light sweep across the label (shimmer) or three pulsing dots (dots), with optional rotating stage phrases and an elapsed timer. Setting status="complete" lets the active sweep glide off and settle to solid text without a hard cut.
Use ThinkingIndicator in the pending reply slot while the model prepares a response. For inspecting nested tool and model latency after steps exist, use Trace waterfall.
Usage
'use client'
import { ThinkingIndicator } from '@uthereal/ui/thinking-indicator'
export function PendingReply({ startedAt }: { startedAt: string }) {
return (
<ThinkingIndicator
label="Thinking"
phrases={['Reading sources', 'Comparing invoices']}
startedAt={startedAt}
/>
)
}Pass an ISO 8601 timestamp with a timezone offset to startedAt to show elapsed time. Keep label short and omit trailing ellipses.
Examples
Dots layout and cycling phrases
shimmer is the default shown in the playground above. dots places three pulsing dots before the label for compact surfaces. Supplying phrases cycles through real stages of work instead of the static label.
Phrases, timing, and completion
| Prop | Default | Behavior |
|---|---|---|
status | 'running' | 'running' animates with aria-busy="true"; 'complete' settles smoothly. |
phrases | [] | Cycles up to 10 visual stage labels every interval ms (500–10,000, default 2000). |
startedAt | — | Displays elapsed duration (8s, 1m 5s) on the client clock in the app locale. |
Rotating phrases are decorative so assistive technology announces label once rather than repeating every visual swap. Elapsed durations format according to the application locale (en-US by default) and begin ticking after hydration to avoid server/client mismatches.
API reference
These serializable arguments and defaults come directly from the component schema.
| Argument | Type / default | Description |
|---|---|---|
label | stringDefault: "Thinking" | Announced once as a polite status, and shown when there are no phrases, e.g. "Thinking". |
status | running | completeDefault: "running" | running while the work goes on (the indicator is busy); complete lets a sweep in flight glide off and the text settle to solid ink, so the end never hard cuts. |
layout | shimmer | dotsDefault: "shimmer" | shimmer sweeps Arc's light band across the text; dots shows three pulsing dots before it, on the same rhythm. |
phrases | string[]Default: [] | Up to ten phrases shown in turn instead of the label, e.g. "Reading sources", "Comparing invoices". Visual only: screen readers hear the label. |
interval | integerDefault: 2000 | How long each phrase shows, in milliseconds (500 to 10,000). |
startedAt | string— | When the work started, as ISO 8601 with a zone. Shows the elapsed time ("8s", "1m 5s"), counted on the reader's clock after the page hydrates. |
recipe | studio | softDefault: "studio" | Visual treatment. Both recipes use the same interaction behavior. |
theme | ThinkingIndicatorTheme— | Color mode and text tokens. See Theming. |
motion | none | subtle | expressiveDefault: "subtle" | The sweep, dots, phrase swap, width spring and rolling timer. A reduced-motion preference stops the sweep and dots and crossfades phrases; none keeps it static on the first phrase. |
motionOptions | ThinkingIndicatorMotionOptions— | duration: one sweep across the text in milliseconds (default 1800); a rest of .32 of it follows each pass. |
dir | ltr | rtl— | Reading direction. Omit it to inherit the page direction. |
React integration
| Prop | Purpose |
|---|---|
preset | Application defaults, overridden by explicit instance arguments. |
tokens | CSS variables applied after the typed theme. |
ref, className, style | Applied to the root <span> status element. |
| Native attributes | id, aria-*, data-*, and remaining <span> props forwarded to the root. |
Keyboard & accessibility
ThinkingIndicator is non-interactive and is not in the tab order. The root element renders role="status" and sets aria-busy="true" while status="running". A visually hidden span announces label politely once, while the visible shimmer text, dots, rotating phrases, and timer carry aria-hidden="true". Reading direction inherits from the page or follows dir. Under forced-colors, text renders in plain system color without a gradient mask.
Motion and theming
A highlight band sweeps across the text once every motionOptions.duration milliseconds (default 1800, range 600–6000), followed by a rest of 0.32 × duration. Sweeps pause automatically while the indicator is offscreen or the tab is hidden. Pulsing dots follow the same cadence, incoming phrases rise through a subtle blur as the width springs to fit, and elapsed digits roll on change. prefers-reduced-motion: reduce stops the sweep and dots and crossfades phrases; motion="none" keeps the first phrase static with no animation.
theme accepts a mode and text tokens (foreground, mutedForeground, fontFamily, fontSize). Font weight inherits from surrounding text. An application-wide UtherealProvider supplies defaults.
Composition
In an agent composition, ThinkingIndicator is a leaf placed where the upcoming reply will appear. It stores no host state and dispatches no actions. See Building with agents.
{
"type": "ThinkingIndicator",
"props": {
"label": "Researching",
"phrases": ["Reading sources", "Comparing invoices"]
},
"children": []
}