Skip to main content

TurnStatus

Agent Activityai

In-turn footer reporting the three facts a running turn owes the user: elapsed time, cost, and how to stop it.

import { TurnStatus } from "@elabs-ai/components-ai";
Install
npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai

Skipping the @source line is the most common first failure: Tailwind does not scan node_modules, so every component renders unstyled. The one-time wiring

Prompt for your coding agent

Paste it into Claude Code, Cursor, Codex or any other coding agent. Text in [brackets] is yours to fill in.

Add the brand-ui TurnStatus component (from @elabs-ai/components-ai) to this project.

1. Read https://elabs-ai.com/llms.txt first: it maps every package and the rules. If you can use MCP servers, connect https://elabs-ai.com/mcp and use its search, docs and tokens tools. If not, run the same lookups in the terminal: `npx -y @elabs-ai/components-cli search "<what you need>"` and `npx -y @elabs-ai/components-cli docs <Component>`.
2. Look TurnStatus up before writing code: `npx -y @elabs-ai/components-cli docs TurnStatus` prints its real props, variants, what it pairs with and what to avoid.
3. If @elabs-ai/components-ai is not installed yet: `pnpm add @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai` (or `npm install @elabs-ai/components-tokens @elabs-ai/components-ui @elabs-ai/components-ai`). If this is the first brand-ui package in the project, wire it once: import `@elabs-ai/components-tokens/styles.css` plus the `themes/light.css` and `themes/dark.css` stylesheets in the CSS entry, add one Tailwind `@source` line per installed @elabs-ai package (Tailwind does not scan node_modules, so without it everything renders unstyled), and wrap the app root in `ThemeProvider` from `@elabs-ai/components-tokens`.
4. Use it here: [the screen or file, and what it should show]
5. Rules: use only @elabs-ai/components-* components and the semantic tokens — no raw colours, no raw font sizes, no arbitrary Tailwind values. Look up each component's real props with the docs tool before you use it; never guess a prop.
6. Done means: the typecheck passes, `npx -y @elabs-ai/components-cli audit src --strict` reports nothing, and you have opened the app and looked at every screen you touched in the light and the dark theme.

Avoid

  • Announcing every elapsed tick to a live region — announce the label and the settled sentence only, or assistive tech floods.
  • Rendering more than one live region per turn — one region carries the whole status, never one per field.
  • Hiding the stop affordance behind a hover — it must be a focusable button reachable while the turn runs.
  • Fabricating a token count from elapsed time — report what the runtime reports, or omit the field.

Works with

Used inside

Pairs with

Examples

6 live examples

Without Stop

No stop control — just the label and live stats.

Label Only

A minimal working state — only a label, no stats yet.

Settled

The completed-turn line — stats and the stop control disappear; the live region stops announcing further ticks.

With Scroll To Bottom

Adds a "scroll to bottom" affordance beside the stop control.

Live

A live-ticking demo — elapsed time advances every second until Stop settles the turn.

API

TurnStatus

PropTypeDescription
labelstringWhat the turn is doing right now, e.g. `"Working…"`, `"Editing files…"`. Caller-supplied and rendered verbatim — `TurnStatus` never invents this text, so it carries no default and needs no translation key of its own.
elapsedMsnumberElapsed time in the current turn, in milliseconds. Rendered via `formatElapsed`.
tokensTurnStatusTokensToken counts for the turn so far.
turnnumber1-based index of the current turn.
turnTotalnumberTotal number of turns, when known.
status"working" | "settled"`"working"` (default) renders the live stats + stop control and keeps announcing `label` changes. `"settled"` renders the completed-turn line instead and stops announcing (the elapsed/tokens/turn stats and the stop control are hidden — the turn is over).
onStop() => voidRenders a focusable stop button, reachable by keyboard, while `status="working"`.
showScrollToBottombooleanRenders a "scroll to bottom" affordance.
onScrollToBottom() => void

Also accepts: Omit<ComponentProps<"div">, "children">

Theming

The tokens each state resolves to. Change the token and every theme follows.

StateToken
workingbg-primary on the activity dot; text-muted-foreground for the metrics
settledbg-success on the dot; the completed-turn sentence in text-body text-foreground