Loading component…
Loading component…
Who does what in an agent run, and where work changes hands – a lane per person, agent and tool, handoffs as arrows, approvals as diamonds you can approve in place
To reuse this local React demo, copy all files from the Code tab into the same folder, then import HandoffSwimlanes from ./handoff-swimlanes.
import { HandoffSwimlanes, type SwimLane, type SwimTask } from "@/components/ui/handoff-swimlanes";
const lanes: SwimLane[] = [
{ id: "you", name: "You", kind: "person", role: "Owner" },
{ id: "planner", name: "Planner", role: "Splits the work" },
{ id: "coder", name: "Coder", role: "Writes code" },
{ id: "vercel", name: "Vercel", kind: "tool", role: "Deploys", logo: <VercelLogo /> },
];
const tasks: SwimTask[] = [
{ id: "start", lane: "you", title: "Ship the billing fix", kind: "start", after: [] },
{ id: "plan", lane: "planner", title: "Split into tasks", status: "done", duration: "14s" },
{ id: "fix", lane: "coder", title: "Fix invoice rounding", status: "active" },
{ id: "approve", lane: "you", title: "Approve deploy", kind: "gate" },
{ id: "deploy", lane: "vercel", title: "Deploy to production" },
{ id: "end", lane: "you", title: "Shipped", kind: "end" },
];
export function Run() {
return <HandoffSwimlanes title="Ship the billing fix" lanes={lanes} tasks={tasks} onApprove={(t) => approve(t.id)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| lanes | SwimLane[] | One row per participant, top to bottom – { id, name, kind?, role?, logo?, color?, description? } | |
| kind | "person" \| "agent" \| "tool" | A person gets the full pixel mark in ink, an agent its own pixel mark in its color, a tool its logo or a grey mark | |
| tasks | SwimTask[] | Everything that happens – { id, lane, title, status?, kind?, after?, duration?, detail? }, placed in the lane named by lane | |
| status | "queued" \| "active" \| "waiting" \| "done" \| "failed" \| "skipped" | Queued by default – running shimmers in its agent's color, waiting is amber, failed red. A failed task whose work was handed on – a retry, a fix – stays red but no longer marks the run as failed | |
| kind (task) | "task" \| "gate" \| "start" \| "end" | A box, an approval diamond, or the run's start and end circles | |
| after | string[] | The tasks that hand over to this one – by default the one before it in the list; [] starts a new branch | |
| title | string | The heading – "Handoffs" by default – and the section's accessible name | |
| onSelect | (task \| null) => void | A box's card opened or closed | |
| onApprove / onReject | (task) => void | Show Approve and Reject in the card of a gate that's waiting | |
| laneHeight | number | 60 | Height of a lane in px, 48 at least – lower it when the diagram shares the page with a list or more |
| fitHeight | number | Room in px the diagram may fill in height – when the width alone would scale it down, it grows back into this room (up to its own size) and scrolls sideways instead, the lane names staying put | |
| className | string | Extra class on the root – set the color variables on it |
Fills its container's width – spare room spreads over the columns
Short of room the gaps narrow first, then the boxes; still too wide, the whole diagram scales down to fit – it never scrolls sideways
Below 520px the lanes show only their marks; the name is in the lane's card
Titles and lane names end in … – the full text is in the card; Arabic and other scripts read in their own direction
Tasks in a lane that doesn't exist, handovers from ids that don't exist and repeated ids are left out; a loop is cut where it closes
Lanes without any tasks read Nothing to hand over yet; no lanes at all the same
Cards open below what you clicked, above it near the bottom of the screen, and never leave the component's width
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"