# React Native AI approval card, human in the loop (Pro)

> A React Native approval card for AI assistants and agents on iOS, Android and the web: what the assistant wants to change, each value before and after, Approve or Cancel, a spinner while it runs, then Done, Cancelled or what failed. Announced to screen readers, right to left aware.

# Approval card Pro

What an assistant wants to change, held until the person says yes: the action as a title, each change before and after, and **Approve** or **Cancel**, the way Shopify Sidekick and Copilot ask before they act. While it runs the Approve button spins; then the card says Done, Cancelled or what failed, and keeps the buttons away. Use it for anything that can't be taken back (money moving, a message sent); a change that can be undone should just happen, with Undo in a toast.

```tsx
import { ApprovalCard } from '@patine-ui/pro';
```

```tsx live
import { useState } from 'react';
import { ApprovalCard } from '@patine-ui/pro';

export default function Example() {
  const [status, setStatus] = useState('pending');
  return (
    <ApprovalCard
      title="Add $50 to Japan in spring"
      description="From your checking account. It shows in the goal right away."
      changes={[{ label: 'Japan in spring', before: '$3,420', after: '$3,470' }]}
      approveLabel="Add $50"
      status={status}
      onApprove={() => {
        setStatus('running');
        setTimeout(() => setStatus('approved'), 1200);
      }}
      onDeny={() => setStatus('denied')}
      style={{ maxWidth: 420 }}
    />
  );
}
```

## In a chat

Draw it from Chat's `renderToolCall` for a tool call whose status is `'approval'`, and map the call's status to the card's: `'running'` → `'running'`, `'done'` → `'approved'`, `'denied'` → `'denied'`, `'error'` → `'error'`. See [AI chat: tool cards and approvals](./ai-chat#tool-cards-and-approvals). The app kit's [`@kit/ai`](../pro/ai-assistant) does it for every write tool.

## Something that can't be undone

`destructive` draws Approve in the danger color. Name the thing and the amount on the button ("Delete 3 invoices"), not "OK".

```tsx live
import { ApprovalCard } from '@patine-ui/pro';

export default function Example() {
  return (
    <ApprovalCard
      icon="trash"
      title="Delete 3 draft invoices"
      changes={[
        { label: 'INV-1042', after: 'Deleted' },
        { label: 'INV-1043', after: 'Deleted' },
        { label: 'INV-1047', after: 'Deleted' },
      ]}
      approveLabel="Delete 3"
      destructive
      onApprove={() => {}}
      onDeny={() => {}}
      style={{ maxWidth: 420 }}
    />
  );
}
```

## Accessibility

| Role | Announced | Keyboard (web) | Touch target | Reduce motion |
| --- | --- | --- | --- | --- |
| A group named by its title and state | "Needs your approval: Add $50 to Japan in spring" as it appears (`announce`); each change as "Japan in spring, from $3,420 to $3,470" | Tab to Cancel and Approve, Enter or Space | 44 pt buttons | No motion of its own |

The buttons say what they do on their own ("Add $50: Add $50 to Japan in spring"), so they make sense out of context. Once answered, the outcome is a status line.

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `title` | `string` | — | Required. The action: "Add $50 to Japan in spring". |
| `description` | `string` | — | Why, or what else happens. |
| `changes` | `{ label, before?, after }[]` | `[]` | Each value before and after; leave `before` out for something new. |
| `icon` | `IconName` | `'shieldCheck'` | Beside the title while it waits. |
| `status` | `'pending'` \| `'running'` \| `'approved'` \| `'denied'` \| `'error'` | `'pending'` | `'pending'` shows the buttons; `'running'` spins Approve. |
| `onApprove` / `onDeny` | `() => void` | — | |
| `approveLabel` | `string` | `'Approve'` | |
| `destructive` | `boolean` | `false` | Approve in the danger color. |
| `error` | `string` | — | What failed, with `'error'`. |
| `announce` | `boolean` | `true` | Says the request as the card appears. |
| `labels` | `Partial<ApprovalLabels>` | English | `approve`, `deny`, `running`, `approved`, `denied`, `failed`, `request`, `from`, `to`. |
| `design` / `theme` / `style` | | | |

## Related

- [AI chat](./ai-chat)
- [Agent activity](./agent-activity)
- [Kit: AI assistant](../pro/ai-assistant)
