Requests an agent cannot carry out without you: who asks, what it wants to do, a preview of the action, and Approve / Deny. Decisions go straight back into the run.
Used for
- Approve a refund
- Run a shell command
- Merge a change
- Spend over budget
- Send an email
Examples
Installation
npx knowns-ui@latest add approval-promptFor Claude Code, Cursor or Codex: installs it and wires the props to your own data.
Paste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install prompt
Install Approval prompt from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/approval-prompt
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add approval-prompt
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- lib/knowns/icons/actor-icon.tsx
- lib/knowns/icons/model-icons.tsx
- lib/knowns/icons/tool-icons.tsx
- lib/knowns/icons/model-icons.data.ts
- lib/knowns/icons/tool-icons.data.ts
- lib/knowns/icons/LICENSES.md
- components/ui/knowns/spinner.tsx
- components/ui/knowns/button.tsx
- lib/knowns/motion.tsx
- lib/knowns/motion-utils.ts
- components/ui/knowns/code-block/code-block.tsx
- components/ui/knowns/code-block/code-block-utils.ts
- components/ui/knowns/approval-prompt/approval-prompt.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0, class-variance-authority@^0.7.1.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/approval-prompt, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "approval-prompt" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- run
AgentRun- Read approvals from a run and emit decisions to it.
- approvals / actors
Approval[] / Actor[]- Default
[] - Plain data instead of a run.
- onDecision
(approval, decision) => void- Called on every Approve or Deny.
- history
number- Default
3 - Resolved requests kept under the pending ones.
- empty
ReactNode- Default
nothing - Shown when nothing is waiting and there is no history.
- live
boolean- Default
true - Announce new requests to screen readers. Turn it off for demos that ask on a timer.
| Prop | Type | Default | Description |
|---|---|---|---|
| run | AgentRun | - | Read approvals from a run and emit decisions to it. |
| approvals / actors | Approval[] / Actor[] | [] | Plain data instead of a run. |
| onDecision | (approval, decision) => void | - | Called on every Approve or Deny. |
| history | number | 3 | Resolved requests kept under the pending ones. |
| empty | ReactNode | nothing | Shown when nothing is waiting and there is no history. |
| live | boolean | true | Announce new requests to screen readers. Turn it off for demos that ask on a timer. |
What it handles
- 01Lists every request waiting for a person, newest first, with who asks, what it wants and how long ago.
- 02Shows a preview of the action under the title: a command, a diff or your own node through renderDetail.
- 03Sends Approve and Deny back into the run as an approval.resolve event, so the agent carries on.
- 04Keeps the last few decisions listed under the pending ones, so you can see what was just resolved.
- 05Announces a new request to screen readers through a polite live region, which you can turn off for demos.
- 06Reads from a run or from plain props, so it works inside an agent view or on its own.
States
- New request
- The card appears at once and the live region announces it
- none
- Press Approve or Deny
- The button scales to 0.97
- 120ms, ease out
- Decided
- The card leaves the pending list and a row joins the history
- none
- Age label
- The time since the request updates
- every 5s, no animation
- Reduced motion
- The press does not scale
- 0ms
| State | What moves | Timing |
|---|---|---|
| New request | The card appears at once and the live region announces it | none |
| Press Approve or Deny | The button scales to 0.97 | 120ms, ease out |
| Decided | The card leaves the pending list and a row joins the history | none |
| Age label | The time since the request updates | every 5s, no animation |
| Reduced motion | The press does not scale | 0ms |
Works with
When to use
When to use
- Approving a tool call before it runs: several requests wait for a human decision, each with a preview and Approve or Deny.
- Review queues across runs, where people work through approvals one by one.
When not to use
- One request inline in a chat thread, with risk and scope: use Autonomy & Permissions.
- Confirming a destructive action of your own app: use Dialog.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Approval Prompt to my app and wire it to my own data.
- I need approving a tool call before it runs: several requests wait for a human decision, each with a preview and Approve or Deny. Set that up with the Knowns UI Approval Prompt.
- Which Approval Prompt props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "approval-prompt" }) and search_docs({ query: "approval prompt" }).