Loading component…
Loading component…
One agent hands a big job to many workers – every task a cell on a live grid that fills in as they get through it, with retries, failures, cost and the time left
To reuse this local React demo, copy all files from the Code tab into the same folder, then import Fan-outGrid from ./fan-out-grid.
import { FanoutGrid, type FanoutTask } from "@/components/ui/fan-out-grid";
const tasks: FanoutTask[] = leads.map((lead) => ({
id: lead.id,
label: lead.domain,
status: lead.status, // "queued" | "running" | "retrying" | "done" | "failed"
worker: lead.worker,
start: lead.startedMs, end: lead.endedMs,
cost: lead.cost, attempts: lead.attempts,
result: lead.summary, error: lead.error,
}));
export function Enrichment({ elapsed }: { elapsed: number }) {
return <FanoutGrid tasks={tasks} job="Enrich 240 leads" workers={16} now={elapsed} onRetry={(ids) => retry(ids)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| tasks | FanoutTask[] | { id, label, status, worker?, start?, end?, cost?, attempts?, result?, error? } – one per task, in the order the cells should show | |
| status | "queued" \| "running" \| "retrying" \| "done" \| "failed" | Per task – picks the cell's tint: gray, blue with a shine, amber, green, red | |
| start / end | number | Per task, in ms from the start of the job – used for its duration and the time left | |
| attempts | number | Per task – 2 and more show in its details | |
| job | string | What the whole job does, next to the title – e.g. "Enrich 240 leads" | |
| workers | number | How many workers run at once – the time left is worked out from it (defaults to the tasks running now) | |
| now | number | 0 | The clock, in ms from the start of the job |
| onRetry | (ids: string[]) => void | Shows "Retry failed" while tasks have failed, and gets their ids | |
| onSelect | (task \| null) => void | A task was picked (click or Enter) – null when it's let go | |
| formatCost | (amount: number) => string | dollars | Formats every cost |
| title | string | "Fan-out" | Heading of the bar |
| icon | ReactNode | A small mark before the title, e.g. the agent's logo | |
| className | string | Extra class on the root |
Built on a container query: the grid fills whatever width it gets, the cells wrap into rows
Under 520px the cells get smaller and the numbers move to a line of their own
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"