Loading component…
Loading component…
A live status of background agent tasks for a header or sidebar – one quiet pill that opens into the tasks with their steps, Pause and Resume, and Open on the ones waiting for you
To reuse this local React demo, copy all files from the Code tab into the same folder, then import RunningNow from ./running-now.
import { RunningNow, type RunningTask } from "@/components/ui/running-now";
const tasks: RunningTask[] = [
{ id: "ingest", title: "Ingest pipeline", step: "Embedding chunks", done: 2, total: 4, state: "running" },
{ id: "refund", title: "Refund review", step: "Approve a $240 refund to Acme", done: 1, total: 3, state: "needs-you" },
{ id: "deps", title: "Dependency upgrade", step: "Running 212 tests", done: 1, total: 4, state: "paused" },
];
export function Header() {
return (
<header>
<RunningNow tasks={tasks} onPause={pause} onResume={resume} onOpen={openTask} onOpenAll={() => navigate("/tasks")} />
</header>
);
}| Name | Type | Default | Description |
|---|---|---|---|
| tasks | RunningTask[] | { id, title, step, done, total, state } – in the order they should be listed; the list keeps that order, so rows never swap places | |
| state | "running" \| "paused" \| "needs-you" \| "done" | Per task – running shows Pause, paused shows Resume, needs-you shows a badge and Open, done a full blue ring | |
| onPause / onResume | (id) => void | The icon button on a running or paused row | |
| onOpen | (id) => void | A click on a row, or Open on a task that needs you | |
| onOpenAll | () => void | Shows the "Open Tasks" footer and runs on click | |
| defaultOpen | boolean | false | Starts open |
| open / onOpenChange | boolean / (open) => void | Control the popover from outside | |
| align | "start" \| "end" | "end" | Which edge of the trigger the popover lines up with – end for a header's right side, start for a sidebar |
| labels | Partial<RunningNowLabels> | Every word: title, running, needsYou, needsYouOne (for exactly one – "1 needs you"; falls back to your needsYou), needsYouBadge, paused, pausedCount (the trigger when only paused tasks are left – "5 paused"), done, pause, resume, open, openAll, empty, idle (nothing at all – "No tasks running") | |
| className | string | Extra class on the root |
Every row is 52px in every state – a step that changes, a badge that comes or goes never moves another row
The popover is 348px wide and never wider than the screen minus 32px, so it fits a 375px phone
Touch screens get 36px buttons, a 36px trigger and 56px rows
The list scrolls inside the popover after five and a half rows – the half row shows there is more – and stays clear of short screens
On a phone narrower than 360px, or with four-digit counts below 420px, the trigger keeps only the numbers when both counts show; its label still reads the full summary
Right-to-left: the popover lines up with the logical edge, titles and steps follow their own direction
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"