<!-- Generated by scripts/gen-docs.mts from the JSDoc in registry/. Do not edit; run `pnpm run docs`. -->

# PlanApproval

An agent's plan, waiting for the person before the agent starts on it: Approve, or Request changes, which opens a field to say what should change. Once answered, here or in another app, the buttons give way to one line that says who answered and from where, "Approved by Ana from their phone", which a screen reader hears, with any feedback under it; if the person was on a button or in the field, focus moves to that line. Approve and Request changes are the person's alone: its agent side, `planApprovalAx`, declares them person-only, so no agent door offers them.

## Install

Once per app, with Tailwind CSS v4 and an `@/*` path alias (skip `init` in an existing shadcn app), then the component:

```sh
npx shadcn@latest init --base base --preset nova --yes --no-monorepo
npx shadcn@latest add ourostack/ouro-ui/ouro-base#v1.3.823
npx shadcn@latest add ourostack/ouro-ui/plan-approval#v1.3.823
```

More: [Installing](https://ui.ouroboros.bot/docs/installing.md).

```tsx
import { PlanApproval } from "@/components/ouro/plan-approval/plan-approval";
```

## Example

```tsx
<PlanApproval title="Your agent's plan for dinner" onApprove={approve} onRequestChanges={revise} answer={answer}>
  <Plan steps={steps} />
</PlanApproval>
```

## Use instead when

- Use `PermissionPrompt` instead for one action the agent wants to take, and `ConfirmDialog` instead to confirm the person's own action in your app.

## Props

Type: `PlanApprovalProps`.

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `answer` | `PlanAnswer` |  | The person's answer, once they have given it, in this app or another: the buttons give way to who answered. |
| `answering` | `"approve" \| "changes"` |  | Which answer is on its way, while your app sends it: that button shows it is busy, and the others turn off. |
| `approveLabel` | `string` | `"Approve"` | The approve button's label. |
| `cancelLabel` | `string` | `"Cancel"` | The button that closes the feedback field. |
| `children` (required) | `ReactNode` |  | The plan, as your app renders it: steps, a list, Markdown. |
| `className` | `string` |  | Layout only: margins, width (`mt-2`, `max-w-xl`). Appearance classes warn in development. |
| `feedbackLabel` | `string` | `"What should change?"` | The feedback field's label. |
| `headingLevel` | `2 \| 3 \| 4 \| 5 \| 6` | `3` | The title's heading level, one below the section's heading, as Card's. |
| `onApprove` | `(() => void)` |  | Called when the person presses Approve. |
| `onRequestChanges` | `((feedback: string) => void)` |  | Called with what the person wrote when they send a request for changes. |
| `ref` | `Ref<HTMLDivElement>` |  | Reaches the rendered element. |
| `requestChangesLabel` | `string` | `"Request changes"` | The button that opens the feedback field. |
| `sendLabel` | `string` | `"Send"` | The button that sends the feedback. |
| `title` (required) | `ReactNode` |  | What the plan is for, as its title: "Your agent's plan for dinner". |

## Don't use

These are not props. Passing one fails the type check with the fix in the error, and in development a console message names the fix.

- `onAccept`: Not a prop. Ouro UI uses `onApprove`: `<PlanApproval onApprove={approve}>`.
- `onReject`: Not a prop. Ouro UI uses `onRequestChanges`, which gets the person's feedback: `<PlanApproval onRequestChanges={revise}>`.
- `plan`: Not a prop. The plan is the children: `<PlanApproval title="Plan">{plan}</PlanApproval>`.
- `status`: Not a prop. The person's answer is `answer`: `<PlanApproval answer={{ decision: "approved", by: "Ana" }}>`.

## `className` is for layout only

Pass margins, width and grid placement (`mt-4`, `w-full`, `col-span-2`).

Appearance comes from props, not classes. In development, a class that sets appearance logs one warning per component instance, naming the prop to use instead. A class sets appearance when, after its variants (`hover:`, `sm:`) and any `!` are removed, it starts with `bg-`, `text-`, `border-`, `rounded-`, `shadow-`, `font-`, `ring-`, `from-`, `via-`, `to-`, `fill-` or `stroke-`, or is `border`, `rounded`, `shadow` or `ring`, or has a `dark:` variant. Text wrapping, overflow and table layout classes (`text-wrap`, `text-ellipsis`, `border-collapse`) are layout and do not warn.

Alignment classes (`text-center`) warn too: set alignment on a parent element.

## Types

### `PlanAnswer`

How the person answered a `PlanApproval`.

```ts
interface PlanAnswer {
  /** What they chose. */
  decision: "approved" | "changes-requested";
  /** Who answered: "Ana", "you". */
  by: ReactNode;
  /** Where they answered from, such as "the desktop app" or "their phone": "Approved by Ana from their phone". */
  app?: ReactNode;
  /** When, already formatted ("9:41", `<RelativeTime>`). */
  at?: ReactNode;
  /** What they asked to change, shown under the answer. */
  feedback?: ReactNode;
}
```
