Approval
An agent asks before it acts, and the hold fills the command itself: ink runs through it letter by letter while you hold, so you read what you approve as you approve it. Let go and it drains back.
npx shadcn@latest add @uimaxxer/approvalPasskeysFix the duplicate Stripe charge
Migration 0042 stopped halfway. Get staging back to a clean schema.
Captain
Run pnpm db:reset on staging?
Migration 0042 stopped halfway. Atlas wants a clean schema before it retries.
Drops and reseeds 31 tables on staging-eu. The last backup is from 06:40 today.
pnpm db:reset --env staging --seed fixtures/billing
Run pnpm lint --fix in billing-service?
Formats the 14 files in #482 before review.
pnpm lint --fix --filter billing-service
Approval is a Pro component
The demo and the docs are free. The source comes with Pro, through this page, the shadcn CLI and the MCP.
Usage
import { Approval } from "@/components/ui/approval"
<Approval
dangerous
title={<>Run <code>pnpm db:reset</code> on staging?</>}
effect="Drops and reseeds 31 tables on staging-eu."
command="pnpm db:reset --env staging"
onDecision={({ approved, scope }) => agent.reply(approved, scope)}
/>Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| title | ReactNode | The question. Inline <code> is set as code. | |
| command | string | The exact command. The hold inks it letter by letter; a tapped approval inks it in one quick sweep. | |
| reason | ReactNode | Why the agent wants it. | |
| effect | ReactNode | What it will do. Set in the danger colour when dangerous. | |
| dangerous | boolean | Approve becomes a hold, and always-allow is not offered. | |
| alwaysLabel | ReactNode | Offers a once / always choice, e.g. Always for pnpm lint. | |
| holdDuration | number | 1400 | Hold length in ms for dangerous actions. |
| onDecision | ({ approved, scope }) => void | Called once. The card then collapses to one line. | |
| autoFocus | boolean | true | Focus on mount so Enter and Esc work at once. |
| resolvedLabel | (decision) => ReactNode | Text for the collapsed line. |
Keyboard
- Enter
- Approve
- Esc
- Deny
- Space or Enter (hold)
- Approve a dangerous action
- ← →
- Once or always
Accessibility
- A labelled group: the question is the label, reason and effect are the description.
- Dangerous requests focus the hold button, so a held Enter or Space inks the command and approves, and a tap cannot.
- The command keeps its plain text as its accessible name; the per-letter ink is hidden from assistive tech.
- The scope is a radiogroup with arrow keys. The outcome is announced as status.