How it works
The pill sizes itself to its content and turns every change into motion instead of a cut. The fill is wider than the pill and clipped from the right by --ds-agent-w, a registered length (@property) set to the measured content width, so it can transition: the visible pill grows and shrinks over 520ms while the layout box changes at once. The elapsed time is measured before paint and eased back from where it was (FLIP), so it rides along with the end. The old label leaves upward into a 4px blur and the new one rises out of one. While running, a sheen sweeps across the label (background-clip: text) and a blurred conic gradient of the chart colours turns slowly behind the trailing end. Before the first measurement nothing is clipped, so the server render shows the whole pill.
Use it for
- An assistant or agent working on a request: show which step it is on and for how long.
- Background jobs the person is waiting for: an import, an export, a sync, a build.
- Anywhere one line of live status is better than a full progress list.
Look elsewhere when
- Known, measurable progress (percent, bytes): use a progress ring or the step loader.
- Very short waits under a second: a spinner in the button is enough.
- Tight rows where the width change would push neighbours: give it its own line.
Usage
import { AgentStatus } from './AgentStatus.jsx'
// status: 'running' | 'waiting' | 'done' | 'error'. Pass the current step as label.
export function ImportStatus({ job }) {
return (
<AgentStatus
status={job.state}
label={job.state === 'done' ? `Imported ${job.count} transactions` : job.step}
// Omit elapsed to let the pill count from when it mounted
elapsed={job.seconds}
/>
)
}Props
| Prop | Type | Default | What it does |
|---|---|---|---|
status | 'running' | 'waiting' | 'done' | 'error' | 'running' | Running pulses the orb, sweeps a sheen across the label and shows the glow; waiting uses an amber dot and a slower glow; done and error draw a check or a cross on a disc and let the glow go out. |
label | string | — | The current step, for example “Comparing 46 hotels”. A new value swaps in with the blur motion. Defaults to labels.status[status]. |
elapsed | number | — | Seconds elapsed, when the page owns the clock. Omit it and the pill counts by itself while running or waiting. |
runKey | string | number | — | Restarts the pill's own clock when it changes (a new job). Not needed with elapsed. |
formatTime | (seconds) => string | formatElapsed | Formats the time: “45s”, “1m 05s”, “1h 02m” by default. The helper is exported too. |
showTime | boolean | true | Shows the elapsed time at the end of the pill. |
glow | boolean | true | The iridescent glow behind the trailing end while running or waiting. |
size | 'sm' | 'md' | 'md' | Pill height: 32 or 40px. |
labels | { status: { running, waiting, done, error } } | — | Replaces the built-in fallback labels used when label is not given. |
...rest | HTMLAttributes | — | Other attributes go to the root <div>. |
Accessibility
- The label is read through a polite live region (role="status"); the ticking time is hidden from screen readers so it is not announced every second.
- Status is never colour alone: done and error draw a check or a cross, waiting has its own label.
- The sheen keeps the label's contrast: it sweeps between the secondary and the primary text colour.
- Reduced motion swaps labels with a plain fade, jumps the width and the time, and stops the sheen, pulse and swirl; the glow stays still and fainter.
Motion
Label: leave 240ms ease-in to 7px up and 4px blur; enter 420ms ease-out from 7px below after 70ms. Width and time: 520ms cubic-bezier(0.16, 1, 0.3, 1). Sheen: 2.2s linear loop. Glow: a 3.6s turn and a 2.8s drift. Done: the disc pops with a spring in 360ms and the check draws after 120ms.
Add it to your project
Copy the prompt into Codex or Claude Code. The agent reads the published source, shows you what it will write and adds the component next to your own.
AgentStatus.jsxagent-status.csstokens.cssREADME.md
Both files install together. The stylesheet reads the design tokens in tokens.css and carries fallbacks, so it also works alone.





