Handoff flow
ProWork moving between agents and tools: a handoff runs along the wire between two cards and lands as light that crosses the receiver, changing it as it passes. Cells or Aurora, in Color, Single or Grey.
npx shadcn@latest add @pixilui-pro/handoff-flowPreview
import { useRef } from "react";
import { AgentAvatar, type AgentAvatarColor, type AgentAvatarShape, type AgentAvatarState } from "../../../registry/ui/agent-avatar/agent-avatar";
import { AgentStatus, type AgentStatusState } from "../../../registry/ui/agent-status/agent-status";
import { HandoffFlow, HandoffFlowNode, useHandoffFlowSimulation, type HandoffFlowHandle } from "@/components/pixilui/handoff-flow";
// The first option of each knob is the demo's default; the docs preview starts there.
export const knobs = {
look: ["aurora", "cells"],
tone: ["color", "single", "grey"],
} as const;
const AVATAR: Record<string, AgentAvatarState> = { queued: "idle", running: "writing", done: "done" };
function Card({ node, name, role, color, shape, status, words }: { node: string; name: string; role: string; color: AgentAvatarColor; shape: AgentAvatarShape; status: AgentStatusState; words: string }) {
return (
<HandoffFlowNode node={node} className="grid gap-3 rounded-control bg-surface-muted p-3.5">
<div className="flex min-w-0 items-center gap-2.5">
<AgentAvatar family="pixel" shape={shape} color={color} state={AVATAR[status] ?? "idle"} size={32} name={name} />
<div className="grid min-w-0">
<b className="truncate type-label font-medium text-foreground">{name}</b>
<span className="truncate type-caption text-muted">{role}</span>
</div>
</div>
<div className="flex min-h-6 items-center justify-between gap-2.5">
<span data-flow-words className="truncate type-caption text-secondary">{words}</span>
<span data-flow-status>
<AgentStatus state={status} size="sm" />
</span>
</div>
</HandoffFlowNode>
);
}
/** The reference page's relay piece: a planner hands a task to a coder along the wire, and the coder takes it as the light crosses its card. */
export default function HandoffFlowDemo({ look = "aurora", tone = "color" }: KnobValues<typeof knobs>) {
const flow = useRef<HandoffFlowHandle>(null);
const nodes = useHandoffFlowSimulation(flow);
const coder = nodes.coder ?? { status: "queued", words: "Waiting for work" };
return (
<div className="w-full max-w-xl rounded-panel bg-surface p-8 elevation-raised">
<HandoffFlow ref={flow} look={look} tone={tone} wires={[{ id: "handoff", from: "planner", to: "coder", fam: "code" }]} className="grid min-h-48 grid-cols-[minmax(0,13.5rem)_minmax(0,13.5rem)] items-center justify-between gap-12 max-sm:grid-cols-1 max-sm:ps-7">
<Card node="planner" name="Planner" role="Hands off" color="violet" shape="cloud" status="running" words="Planning" />
<Card node="coder" name="Coder" role="Takes the task" color="cyan" shape="block" status={coder.status as AgentStatusState} words={coder.words} />
</HandoffFlow>
</div>
);
}When to use
Use it when
- An agent team at work: the lead hands off to a researcher and a writer, and each card changes as the work lands on it.
- A run graph, a stream of requests into models, or a trace of steps that draws on as each one finishes.
- Any place the motion should say where work went: the cards stay yours, the flow is the layer under them.
Use something else when
- One element's own moment (a send, a success, a failure): use Aurora light.
- A list of steps with no movement between parts: use the run timeline or the reasoning trail.
- Decoration: every handoff stands for work that moved.
Installation
Join the waitlist and we'll email you when PixilUI launches. The preview, props and docs stay open until then.
Pro installs with the same CLI as the free items. One command adds handoff-flow.tsx and the free aurora-light.tsx, the free agent-avatar.tsx and the free agent-status.tsx it uses; your license key goes in once, as in Installation.
{
"registries": {
"@pixilui-pro": {
"url": "https://pixilui.com/r/pro/{name}.json",
"headers": { "Authorization": "Bearer ${PIXILUI_TOKEN}" }
}
}
}npx shadcn@latest add @pixilui-pro/handoff-flowAdds handoff-flow.tsx with aurora-light.tsx, agent-avatar.tsx and agent-status.tsx, and installs clsx and tailwind-merge. The CLI reads PIXILUI_TOKEN from .env.local; if this computer has not logged in yet, run npx pixilui@latest login once.
components/pixilui/handoff-flow.tsxthe item, 246 linescomponents/pixilui/aurora-light.tsxused inside, freecomponents/pixilui/agent-avatar.tsxused inside, freecomponents/pixilui/agent-status.tsxused inside, freeIt uses Aurora light, Agent avatar and Agent status: add them the same way. Then npm i clsx tailwind-merge, and add the foundation once per app, as in Installation.
Usage
import { HandoffFlow } from "@/components/pixilui/handoff-flow";
<HandoffFlow>Save changes</HandoffFlow>The stage is yours: lay the nodes out with grid or flex; wires follow every layout change, read each frame.
API reference
wiresHandoffFlowWire[][]The wires between nodes.lookRelayLook"cells"Cells (the activity mark's cells, a dithered wave) or Aurora (grey wires with one burst of color, a soft glim).toneRelayTone"color"Color, Single (one hue per meaning) or Grey (silver light; failures stay red).strengthRelayStrength"soft"Aurora's strength: soft (the flow) or full (Aurora light).pausedboolean–Pauses the shared clock (every flow and Aurora light on the page).speednumber–Runs the shared clock slower or faster (0.25 is the reference page's Slow).childrenReact.ReactNode–The nodes (HandoffFlowNode) and anything else on the stage.Also takes every native <div> attribute, and a ref.
Keyboard
Accessibility
- Every canvas is aria-hidden and takes no pointer events: a screen reader hears each card's own words and status, never the light.
- Changes the light carries are real DOM changes on the cards (the status, the words), fired as the light passes them.
- Reduced motion (the OS setting, or data-reduced on <html>) removes every moving light: handoffs set the wire's level at once and arrivals run their changes at once.
Motion
- A handoff runs 380ms plus the wire's length at 760px a second, on cubic-bezier(.36, 0, .27, 1.17): it leaves slowly and lands with a slight overshoot, squeezing into the port.
- Cells: a dithered wave in the receiver's family crosses the card in 1050ms. Aurora soft: a blurred glim with a curved front crosses in 1250ms and fades as it goes.
- Words change with the locked blur swap; a working card keeps a faint held tint (Aurora). One shared clock runs every flow, so paused and speed hold them together.