# Tool Approval

The prompt an agent shows before it runs a tool: which tool, what it will do, and Approve / Deny, with an optional "Always allow". It's a `<section role="group">` named by its own real heading, rather than a landmark region, because a long transcript can hold dozens of these and a region each would flood the landmark list. Once it's approved, follow it with a [Tool Call](/components/tool-call/) for the run itself.

## After a decision

The buttons are replaced by a status line inside a `role="status"` live region. The region is in the page from the start, empty while pending, because a live region only announces changes made after it exists. If focus was on the button that just disappeared, it moves to the status line instead of falling back to the page. The footer keeps the same height either way, so the decision doesn't shift the transcript below it.

## Examples

### Approved

A decided prompt, as it stays in the transcript.

### Denied

Status text is overridable through labels.

## Playground

Toggle every adjustable prop and watch the component — and the code — update live.

## Props

| Prop | Type | Default |
| --- | --- | --- |
| `tool` | ReactNode (required) | — |
| `title` | ReactNode | "Allow `tool` to run?" |
| `headingLevel` | 1 \| 2 \| 3 \| 4 \| 5 \| 6 | 3 |
| `status` / `defaultStatus` | "pending" \| "approved" \| "denied" | "pending" |
| `onStatusChange` | (status) => void | — |
| `onApprove` / `onDeny` | () => void | — |
| `onAlwaysAllow` | () => void (adds the button) | — |
| `labels` | Partial<{ approve, deny, alwaysAllow, approved, alwaysAllowed, denied }> | English defaults |
| `children` | ReactNode (summary, arguments) | — |

The custom element fires bubbling, cancelable `approve`, `deny` and `always-allow` events, then sets its own `status` attribute unless a listener calls `preventDefault()`. Text overrides are attributes: `approve-label`, `deny-label`, `always-allow-label`, `approved-label`, `always-allowed-label`, `denied-label`.

## Accessibility

- The group's name is its heading, so "Allow bash to run?" is announced when focus enters the buttons.
- Actions are real `<button>` s; the decision is announced politely through `role="status"`.
- Focus is never dropped to `<body>` when the buttons are removed.
