A permission prompt for approving an AI agent's tool call — status badge, expandable parameters, and allow / deny actions.
Running
Allow once to watch the live status roll — approving spinner, approved, running, then complete. Replay resets the demo.
Loading…
Installation
CLI
Also needs
npx @sonojs/ui@latest add agent-code agent-disclosure && npm i lucide-react motion shikiUsage
tool-approval.tsx
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| tool | ReactNode | — | Tool name shown in mono under the title. |
| title | ReactNode | "Allow this tool to run?" | Primary question for the permission prompt. |
| description | ReactNode | — | Optional supporting copy under the tool name. |
| parameters | ToolApprovalParameter[] | [] | Expandable detail rows (`id`, `label`, `value`). Use `ToolApprovalCode` for highlighted snippets. |
| status | ToolApprovalStatus | "pending" | `pending` | `approving` | `approved` | `denied` | `running` | `complete` | `error`. |
| open / defaultOpen / onOpenChange | boolean / fn | uncontrolled | Controls the parameters disclosure. |
| onApprove / onAlwaysAllow / onDeny | () => void | — | Pending-state action handlers. |
| className | string | — | Merge classes on the card root. |