Loading component…
Loading component…
The approval requests of an agent run as a stack of cards – the one to decide now on top with the diff or arguments, approve, reject or change it, then the next rises
To reuse this local React demo, copy all files from the Code tab into the same folder, then import ApprovalGates from ./approval-gates.
import { ApprovalGates, type ApprovalGate } from "@/components/ui/approval-gates";
const gates: ApprovalGate[] = [
{
id: "migrate",
agent: "Coder",
kind: "tool",
action: "Run the database migration",
reason: "Changes the production schema",
status: "approved",
at: "6m ago",
},
{
id: "prices",
agent: "Coder",
kind: "file",
action: "Change prices in pricing.ts",
reason: "Changes what customers pay from Monday",
status: "open",
at: "1m ago",
diff: [{ file: "src/billing/pricing.ts", lines: [{ type: "del", text: "pro: { seat: 8 }," }, { type: "add", text: "pro: { seat: 10 }," }] }],
holds: ["Deploy to production", "Post to #launch"],
},
];
export function RunApprovals() {
return <ApprovalGates gates={gates} task="Launch the new pricing page" live onDecide={(id, decision, value) => agent.decide(id, decision, value)} />;
}| Name | Type | Default | Description |
|---|---|---|---|
| gates | ApprovalGate[] | Every gate of the run, in the order they came up – open ones form the stack, the rest the Decided list | |
| task | string | What the run is about – shown muted next to the title | |
| live | boolean | false | The run is still going: with nothing open it reads Running, and new requests slide in behind the stack |
| onDecide | (id, decision: "approved" \| "edited" \| "rejected", value?: string) => void | A gate was decided – with edited, value is the changed input, or for a file change what should change | |
| title | string | "Approvals" | Heading of the block on top |
| className | string | Extra class on the root |
No layer around it all – the block on top, the card and the Decided list each bring their own gray layer with a white card on it, share one width (--ui-gate-w, 560px) and sit straight in your panel
Narrow, the numbers wrap onto two rows and the decided rows drop the agent's name
Dark mode built in: switches when an ancestor (usually <html>) has the class dark or data-theme="dark"