# ApprovalCard

> A human-in-the-loop gate before a side effect: the agent states what it is about to do, and the footer swaps its approve and deny buttons for a one-line verdict once someone decides.

- Package: `fancy-ui-react` (React 18/19 + Tailwind CSS v4)
- Category: AI Agents
- Tags: ai, agents, approval, human-in-the-loop, gate
- Types: `ApprovalCardProps`, `ApprovalState`
- Docs: https://fancy-ui.rama.app/docs/components/approval-card
- Source: https://github.com/RamaHerbin/fancy-ui/tree/main/react/src/components/approval-card

## Import

```tsx
import { ApprovalCard } from 'fancy-ui-react';
```

Setup (once per project): `npm install fancy-ui-react`, then put these lines in your main CSS file (the stylesheet import goes right after `@import "tailwindcss";`):

```css
@import "tailwindcss";
@import "fancy-ui-react/tailwind.css";
```

and import the component styles once in the app entry: `import "fancy-ui-react/styles.css";`. Full guide: https://fancy-ui.rama.app/llms.txt

The names below are the ones to write in React; when one differs from the Svelte name, the Svelte name follows in parentheses. `class` becomes `className`, a callback takes the name the React port declares (`onclick` becomes `onClick`), snippets become `ReactNode` props (render functions when they take arguments) and the default snippet is `children`. Divergences: https://github.com/RamaHerbin/fancy-ui/tree/main/react#divergences-from-the-svelte-api

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` (required) | `string` | — | What permission is being asked for, e.g. "Run database migration" |
| `description` | `string` | — | Muted second line under the title — the consequence, the blast radius |
| `state` | `"pending" \| "approved" \| "denied"` | `"pending"` | Which side of the gate we are on (bindable). Buttons exist only while pending; writing a resolved value from outside settles the card without firing a callback |
| `destructive` | `boolean` | `false` | Marks the action as irreversible: red approve button, a warning tint on the card, and an alert mark on the shield so the warning is not carried by colour alone |
| `approveLabel` | `string` | `"Approve"` | Label for the approve button |
| `denyLabel` | `string` | `"Deny"` | Label for the deny button |
| `onApprove` | `() => void` | — | Called when approve is pressed, after state has been written |
| `onDeny` | `() => void` | — | Called when deny is pressed, after state has been written |
| `busy` | `boolean` | `false` | The consumer is executing the decision: both buttons go disabled and the card is marked aria-busy |
| `sound` | `boolean` | `false` | Plays select on both approve and deny, once the user has enabled sound |

## Node props

| Prop | Description |
| --- | --- |
| `children` | Detail region between the header and the footer — a diff, a command preview, the payload about to be posted |

## Example

No React example is published for this component yet: start from the import above and the props table. The full examples are Svelte-only, on https://fancy-ui.rama.app/docs/components/approval-card.md.
