# Approval Card

Questions and actions an agent asks a person to approve before it goes on.

The decisions an agent asks for before it acts, so a person can approve or steer the work. Two modes. Questions: one at a time, the card's height follows the question while the stack slides, the step counter rolls, a single-choice pick auto-advances and a multi-select waits; a custom answer row, Previous/Next, a ghost Skip and an accent Continue; settles into an 'Answers sent' pill. Approve (the action prop): one action described (title, a sentence, the exact command, its details), an optional 'Always allow' checkbox, Deny and an accent Approve; settles into an 'Approved' (green) or 'Denied' (neutral) pill.

Kind: block · Category: Agent · Status: beta · Targets: React, Vue, Svelte

## Add

```bash
npx fndn add approval-card
```

It writes the folder `approval-card/` into the project's ui folder (`index.ts`, `approval-card.tsx`, `ApprovalCard.vue`, `ApprovalCard.svelte`, `approval-card.recipe.ts`), and what it is built from: [Button](/components/button.md), [Radio Group](/components/radio-group.md), [Checkbox](/components/checkbox.md), [Pager](/components/pager.md), [Status Pill](/components/status-pill.md), [Tooltip](/components/tooltip.md). First time: [Installation](/installation.md).

## Usage

```tsx
import { ApprovalCard } from "@/components/ui/approval-card";
```

```vue
import { ApprovalCard } from "@/components/ui/approval-card";
```

```svelte
import { ApprovalCard } from "$lib/components/ui/approval-card";
```

## Parts

In the DOM the root carries `data-slot="approval-card"` and each part `data-slot="approval-card-<part>"`; in the recipe the root is the `base` slot and each part a slot named after it in camelCase.

| Part | Element | data-slot | Flags | Notes |
| --- | --- | --- | --- | --- |
| `root` | `div` | `approval-card` |  | data-state open \| sent \| closed; data-measured once the slide has measured the active question |
| `status` | `span` | `approval-card-status` |  | role=status, sr-only; says the sent message when the answers go |
| `card` | `div` | `approval-card-card` |  | surface, rounded-card, shadow-card |
| `dismiss` | `button` | `approval-card-dismiss` |  | A Button (ghost sm square rounded muted), pinned top right; aria-label and our tooltip (Tooltip) |
| `body` | `div` | `approval-card-body` |  |  |
| `viewport` | `div` | `approval-card-viewport` |  | clips to the active question; its height animates to fit |
| `track` | `div` | `approval-card-track` |  | every question stacked; translates to the active one |
| `step` | `div` | `approval-card-step` |  | one question; data-active on the current one, the others are inert and transparent |
| `question` | `div` | `approval-card-question` |  | the question is the heading |
| `options` | `div` | `approval-card-options` |  | the answers. Single choice: a radio-group (data-layout="row", aria-label = the question) with its own highlight and its custom row. Multi-select: role=group (aria-label = the question) holding the highlight, checkbox rows (layout="row") and the custom row |
| `highlight` | `span` | `approval-card-highlight` | optional | multi-select only: the list's glide layer (`glideLayer` of `lib/glide.ts`) (a radio-group brings its own) |
| `action` | `div` | `approval-card-action` | optional | Approve mode, in the body: the question part as its heading (the action's title), then description, command and details, 8px apart |
| `description` | `p` | `approval-card-description` | optional | What the action does and why, ink-2 |
| `command` | `pre` | `approval-card-command` | optional | The exact command or call: inset fill, radius.control, mono xs on a 20px line, wraps anywhere, left to right in right-to-left pages |
| `details` | `dl` | `approval-card-details` | optional | Facts about the action: a two-column grid, labels ink-2, values ink (mono when the detail says so), values wrap anywhere |
| `detail` | `div` | `approval-card-detail` | optional, repeats | One fact (display: contents, so its term and value sit in the grid) |
| `detail-label` | `dt` | `approval-card-detail-label` | optional, repeats |  |
| `detail-value` | `dd` | `approval-card-detail-value` | optional, repeats |  |
| `always` | `div` | `approval-card-always` | optional | Approve mode with alwaysAllow: the real Checkbox (sm, "Always allow"), marked data-approval-card="always", at the start of the footer where the pager sits in question mode |
| `footer` | `div` | `approval-card-footer` |  | Question mode: the pager (orientation=vertical, reel, separator "/", unit "Question"; none for a single question, which needs no "1/1") and the actions, always at the end. Approve mode: the Always allow checkbox (or nothing) and the actions |
| `actions` | `div` | `approval-card-actions` |  | Question mode: Skip (ghost sm: no fill at rest) and Continue / Send (accent sm). Approve mode: Deny (ghost sm) and Approve (accent sm) |
| `sent` | `div` | `approval-card-sent` |  | The settled view: a status-pill and the reset button. Questions: "Answers sent" (green, mark). Approve: "Approved" or "Always allowed" (green, mark), "Denied" (neutral, dot) |
| `reset` | `button` | `approval-card-reset` | optional | Start over (questions) or Change (approve): the Button ghost sm muted, marked data-approval-card="reset"; reopens the card with nothing picked |
| `reopen` | `button` | `approval-card-reopen` | optional | Open approval: a Button (outline sm), marked data-approval-card="reopen"; shown when dismissed |

## Props

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `questions` | `{ q: string; type: radio \| check; options: string[] }[]` |  | Question mode: the questions, one at a time. Leave it out with action. |
| `action` | `{ title: string; description?: string; command?: string; details?: { label: string; value: string; mono?: boolean }[] }` |  | Approve mode: the one action the agent asks to take. title is the heading, as a question ("Run the migration on Production?"); description says what it does in a sentence; command is the exact command or call; details are facts (Branch: main, Rows affected: 1,284), mono for code. Replaces the questions. |
| `alwaysAllow` | `boolean` | `false` | Approve mode: offer an "Always allow" checkbox beside Deny / Approve; the decision event says whether it was ticked. |
| `index` | `number` | `0` | Bindable (React: `defaultIndex` and `onIndexChange`; Vue: `v-model:index`; Svelte: `bind:index`). Active question. |
| `state` | `"open" \| "sent" \| "closed"` | `"open"` | Bindable (React: `defaultState` and `onStateChange`; Vue: `v-model:state`; Svelte: `bind:state`). open → sent after the last answer or the decision, closed after dismiss. |
| `defaultAnswers` | `object` |  | Answers to start with: question index → selected option indexes. |
| `resettable` | `boolean` | `true` | Show 'Start over' after sending. |
| `appear` | `boolean` | `false` | Whether the card fades up when it mounts. Off by default: set it on the card your code adds live, never on one rendered from history or with the page (a mount is not an arrival). A reopened card fades up either way. |
| `labels` | `object` |  | { skip, continue, send, customPlaceholder, customLabel, sentMessage, startOver, reopen, dismiss, previous, next, pager (the pager's accessible name), unit (read before the pager's position); approve mode: approve, deny, alwaysAllow, approved, alwaysAllowed, denied, change } |

Other attributes and `class` go to the root; `class` is merged through the recipe.

## Events

| Event | Payload |
| --- | --- |
| `submitted` | (answers: Record<number, number[]>, custom: Record<number, string>) when the last question is answered |
| `answerChange` | (questionIndex, answer: number[]) |
| `dismiss` | when the card is closed |
| `decision` | Approve mode: (decision: 'approve' \| 'deny', always: boolean) when Approve or Deny is pressed; always is true only for an approval with Always allow ticked |

## States

`option-hover`, `option-press`, `option-checked`, `focus-visible`, `nav-disabled`, `continue-disabled`, `sliding`, `sent`, `closed`, `approved`, `denied`

## Keyboard and accessibility

Role: Questions: a radiogroup or a group of checkboxes per question. Approve: a heading, a description list and two buttons.

Keyboard:

- Single choice: one tab stop; ArrowUp / ArrowDown (and Left / Right) move and select; selecting from the keyboard never auto-advances
- Multi-select: each checkbox is a tab stop; Space toggles
- Enter on an answered question (on a choice or in the custom field) continues; on the last question it sends
- Previous / Next question are the pager's labelled buttons (Enter / Space); with focus in the pager ArrowUp / ArrowDown (and Left / Right, Home / End) move between questions; at the ends the buttons are aria-disabled and keep focus; focus follows into the new question when it was inside the old one
- Skip moves on (dismisses on the last question); Dismiss closes and focus moves to 'Open approval'
- Approve mode: Tab reaches Always allow (Space toggles), Deny and Approve (Enter / Space decide); focus then moves to Change in the settled view

Notes:

- Each question names its group (aria-label = the question). Inactive questions are inert.
- The pager's position is a status region: 'Question n / N' is announced when the question changes; its rolling digits are aria-hidden.
- Sending announces the sent message through role=status and moves focus to Start over.
- Keyboard moves between questions are instant (kbd-instant on viewport, track, steps and the pager's reels).
- Dismiss carries our tooltip with the text of its aria-label.
- Approve mode: the decision is announced through the same role=status ("Approved", "Always allowed" or "Denied"). Nothing takes focus when the card appears: it never steals focus from what the person was typing.

## Motion

- card: fndn-fade-up over duration.enter on reopen, and on mount only with appear
- dismiss: with a pointer the card fades out (opacity only, duration.fast, data-leaving), then it is hidden; from the keyboard and under reduced motion it is hidden at once
- question slide: viewport height + track translateY over duration.move, easing.out-strong; transitions, so rapid Next/Previous retarget
- question crossfade: step opacity over duration.base (kept under reduced motion, where travel drops to 0)
- counter: the pager's digit reel rolls over duration.move easing.out-strong (up going forward, down going back), with the slide
- highlight: glides between rows over duration.move (radio-group's own layer, or the multi-select list's)
- radio and check marks: drawn by radio-group and checkbox (fill leads, mark drawn, shorter exit)
- single choice auto-advances 480ms after a pointer pick
- after dismiss / send: the reopen button or the sent view fades in over duration.base where the card was (@starting-style, armed after the first render: never on first paint; instant from the keyboard)
- sent pill: the status-pill's own mark pop-in over duration.popup when the sent view appears (never on first paint)
- approve mode: nothing slides (one decision, no track); the card's arrival, dismissal and the settled view's fade are the question mode's

## Tokens

`color.ink`, `color.surface`, `color.hover`, `color.hover-2`, `shadow.btn`, `shadow.card`, `duration.base`, `duration.enter`, `duration.fast`, `duration.move`, `duration.press`, `easing.out-strong`, `motion.press-scale`, `radius.card`, `radius.control`, `text.md`, `text.sm`, `text.xs`, `color.ink-2`, `color.inset`, `font.mono`

## Dependencies

- [Button](/components/button.md)
- [Radio Group](/components/radio-group.md)
- [Checkbox](/components/checkbox.md)
- [Pager](/components/pager.md)
- [Status Pill](/components/status-pill.md)
- [Tooltip](/components/tooltip.md)

## Examples

### Before migrating the bookings table

React · `question.tsx`

```tsx
import type { ComponentProps } from "react";
import { ApprovalCard } from "@/components/ui/approval-card";

type Props = ComponentProps<typeof ApprovalCard>;

const questions: Props["questions"] = [
  {
    q: "When should I migrate the bookings table (2.4M rows)?",
    type: "radio",
    options: [
      "Now, with a 40-second write lock",
      "Tonight at 02:00 UTC, the quietest hour",
      "Online in batches, about 25 minutes",
    ],
  },
  {
    q: "Where should it run first?",
    type: "check",
    options: ["Staging", "EU production", "US production"],
  },
  {
    q: "If a health check fails afterwards, what should I do?",
    type: "radio",
    options: [
      "Roll back automatically",
      "Pause and page Maya Chen",
      "Keep going and log it",
    ],
  },
];

export default function Question() {
  return <ApprovalCard questions={questions} defaultIndex={0} />;
}
```

Vue · `question.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { ApprovalCard, type ApprovalQuestion } from "@/components/ui/approval-card";

const questions: ApprovalQuestion[] = [
  {
    q: "When should I migrate the bookings table (2.4M rows)?",
    type: "radio",
    options: [
      "Now, with a 40-second write lock",
      "Tonight at 02:00 UTC, the quietest hour",
      "Online in batches, about 25 minutes",
    ],
  },
  {
    q: "Where should it run first?",
    type: "check",
    options: ["Staging", "EU production", "US production"],
  },
  {
    q: "If a health check fails afterwards, what should I do?",
    type: "radio",
    options: [
      "Roll back automatically",
      "Pause and page Maya Chen",
      "Keep going and log it",
    ],
  },
];

const index = ref(0);
</script>

<template>
  <ApprovalCard :questions="questions" v-model:index="index" />
</template>
```

Svelte · `question.svelte`

```svelte
<script lang="ts">
  import { ApprovalCard, type ApprovalQuestion } from "$lib/components/ui/approval-card";

  const questions: ApprovalQuestion[] = [
    {
      q: "When should I migrate the bookings table (2.4M rows)?",
      type: "radio",
      options: [
        "Now, with a 40-second write lock",
        "Tonight at 02:00 UTC, the quietest hour",
        "Online in batches, about 25 minutes",
      ],
    },
    {
      q: "Where should it run first?",
      type: "check",
      options: ["Staging", "EU production", "US production"],
    },
    {
      q: "If a health check fails afterwards, what should I do?",
      type: "radio",
      options: [
        "Roll back automatically",
        "Pause and page Maya Chen",
        "Keep going and log it",
      ],
    },
  ];

  let index = $state(0);
</script>

<ApprovalCard questions={questions} bind:index={index} />
```

### Choose who gets the outage email

React · `multi-select.tsx`

```tsx
import type { ComponentProps } from "react";
import { ApprovalCard } from "@/components/ui/approval-card";

type Props = ComponentProps<typeof ApprovalCard>;

const questions: Props["questions"] = [
  {
    q: "The summary of yesterday's booking outage is drafted. Which customers should get it?",
    type: "check",
    options: [
      "Accounts with failed bookings (38)",
      "Accounts with an open ticket (17)",
      "Every Business plan account (412)",
    ],
  },
  {
    q: "Who should it come from?",
    type: "radio",
    options: [
      "Priya Raman, Support lead",
      "The Harbor status team",
      "Each account's success manager",
    ],
  },
  {
    q: "When should it go out?",
    type: "radio",
    options: ["Right away", "Tomorrow at 09:00 in each customer's time zone"],
  },
];

const answers = { "0": [0, 1] };

export default function MultiSelect() {
  return (
    <ApprovalCard
      questions={questions}
      defaultIndex={0}
      defaultAnswers={answers}
    />
  );
}
```

Vue · `multi-select.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { ApprovalCard, type ApprovalQuestion } from "@/components/ui/approval-card";

const questions: ApprovalQuestion[] = [
  {
    q: "The summary of yesterday's booking outage is drafted. Which customers should get it?",
    type: "check",
    options: [
      "Accounts with failed bookings (38)",
      "Accounts with an open ticket (17)",
      "Every Business plan account (412)",
    ],
  },
  {
    q: "Who should it come from?",
    type: "radio",
    options: [
      "Priya Raman, Support lead",
      "The Harbor status team",
      "Each account's success manager",
    ],
  },
  {
    q: "When should it go out?",
    type: "radio",
    options: ["Right away", "Tomorrow at 09:00 in each customer's time zone"],
  },
];

const answers = { "0": [0, 1] };

const index = ref(0);
</script>

<template>
  <ApprovalCard
    :questions="questions"
    v-model:index="index"
    :defaultAnswers="answers"
  />
</template>
```

Svelte · `multi-select.svelte`

```svelte
<script lang="ts">
  import { ApprovalCard, type ApprovalQuestion } from "$lib/components/ui/approval-card";

  const questions: ApprovalQuestion[] = [
    {
      q: "The summary of yesterday's booking outage is drafted. Which customers should get it?",
      type: "check",
      options: [
        "Accounts with failed bookings (38)",
        "Accounts with an open ticket (17)",
        "Every Business plan account (412)",
      ],
    },
    {
      q: "Who should it come from?",
      type: "radio",
      options: [
        "Priya Raman, Support lead",
        "The Harbor status team",
        "Each account's success manager",
      ],
    },
    {
      q: "When should it go out?",
      type: "radio",
      options: ["Right away", "Tomorrow at 09:00 in each customer's time zone"],
    },
  ];

  const answers = { "0": [0, 1] };

  let index = $state(0);
</script>

<ApprovalCard
  questions={questions}
  bind:index={index}
  defaultAnswers={answers}
/>
```

### Answers sent, the agent goes ahead

React · `sent.tsx`

```tsx
import type { ComponentProps } from "react";
import { ApprovalCard } from "@/components/ui/approval-card";

type Props = ComponentProps<typeof ApprovalCard>;

const questions: Props["questions"] = [
  {
    q: "When should I migrate the bookings table (2.4M rows)?",
    type: "radio",
    options: [
      "Now, with a 40-second write lock",
      "Tonight at 02:00 UTC, the quietest hour",
      "Online in batches, about 25 minutes",
    ],
  },
  {
    q: "Where should it run first?",
    type: "check",
    options: ["Staging", "EU production", "US production"],
  },
  {
    q: "If a health check fails afterwards, what should I do?",
    type: "radio",
    options: [
      "Roll back automatically",
      "Pause and page Maya Chen",
      "Keep going and log it",
    ],
  },
];

const answers = { "0": [2], "1": [0, 1], "2": [1] };

export default function Sent() {
  return (
    <ApprovalCard
      questions={questions}
      defaultIndex={2}
      defaultState="sent"
      defaultAnswers={answers}
    />
  );
}
```

Vue · `sent.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { ApprovalCard, type ApprovalQuestion, type ApprovalState } from "@/components/ui/approval-card";

const questions: ApprovalQuestion[] = [
  {
    q: "When should I migrate the bookings table (2.4M rows)?",
    type: "radio",
    options: [
      "Now, with a 40-second write lock",
      "Tonight at 02:00 UTC, the quietest hour",
      "Online in batches, about 25 minutes",
    ],
  },
  {
    q: "Where should it run first?",
    type: "check",
    options: ["Staging", "EU production", "US production"],
  },
  {
    q: "If a health check fails afterwards, what should I do?",
    type: "radio",
    options: [
      "Roll back automatically",
      "Pause and page Maya Chen",
      "Keep going and log it",
    ],
  },
];

const answers = { "0": [2], "1": [0, 1], "2": [1] };

const index = ref(2);

const state = ref<ApprovalState>("sent");
</script>

<template>
  <ApprovalCard
    :questions="questions"
    v-model:index="index"
    v-model:state="state"
    :defaultAnswers="answers"
  />
</template>
```

Svelte · `sent.svelte`

```svelte
<script lang="ts">
  import { ApprovalCard, type ApprovalQuestion, type ApprovalState } from "$lib/components/ui/approval-card";

  const questions: ApprovalQuestion[] = [
    {
      q: "When should I migrate the bookings table (2.4M rows)?",
      type: "radio",
      options: [
        "Now, with a 40-second write lock",
        "Tonight at 02:00 UTC, the quietest hour",
        "Online in batches, about 25 minutes",
      ],
    },
    {
      q: "Where should it run first?",
      type: "check",
      options: ["Staging", "EU production", "US production"],
    },
    {
      q: "If a health check fails afterwards, what should I do?",
      type: "radio",
      options: [
        "Roll back automatically",
        "Pause and page Maya Chen",
        "Keep going and log it",
      ],
    },
  ];

  const answers = { "0": [2], "1": [0, 1], "2": [1] };

  let index = $state(2);

  let cardState = $state<ApprovalState>("sent");
</script>

<ApprovalCard
  questions={questions}
  bind:index={index}
  bind:state={cardState}
  defaultAnswers={answers}
/>
```

### Dismissed, reopen it later

React · `dismissed.tsx`

```tsx
import type { ComponentProps } from "react";
import { ApprovalCard } from "@/components/ui/approval-card";

type Props = ComponentProps<typeof ApprovalCard>;

const questions: Props["questions"] = [
  {
    q: "When should I migrate the bookings table (2.4M rows)?",
    type: "radio",
    options: [
      "Now, with a 40-second write lock",
      "Tonight at 02:00 UTC, the quietest hour",
      "Online in batches, about 25 minutes",
    ],
  },
  {
    q: "Where should it run first?",
    type: "check",
    options: ["Staging", "EU production", "US production"],
  },
  {
    q: "If a health check fails afterwards, what should I do?",
    type: "radio",
    options: [
      "Roll back automatically",
      "Pause and page Maya Chen",
      "Keep going and log it",
    ],
  },
];

export default function Dismissed() {
  return (
    <ApprovalCard
      questions={questions}
      defaultIndex={0}
      defaultState="closed"
    />
  );
}
```

Vue · `dismissed.vue`

```vue
<script setup lang="ts">
import { ref } from "vue";
import { ApprovalCard, type ApprovalQuestion, type ApprovalState } from "@/components/ui/approval-card";

const questions: ApprovalQuestion[] = [
  {
    q: "When should I migrate the bookings table (2.4M rows)?",
    type: "radio",
    options: [
      "Now, with a 40-second write lock",
      "Tonight at 02:00 UTC, the quietest hour",
      "Online in batches, about 25 minutes",
    ],
  },
  {
    q: "Where should it run first?",
    type: "check",
    options: ["Staging", "EU production", "US production"],
  },
  {
    q: "If a health check fails afterwards, what should I do?",
    type: "radio",
    options: [
      "Roll back automatically",
      "Pause and page Maya Chen",
      "Keep going and log it",
    ],
  },
];

const index = ref(0);

const state = ref<ApprovalState>("closed");
</script>

<template>
  <ApprovalCard
    :questions="questions"
    v-model:index="index"
    v-model:state="state"
  />
</template>
```

Svelte · `dismissed.svelte`

```svelte
<script lang="ts">
  import { ApprovalCard, type ApprovalQuestion, type ApprovalState } from "$lib/components/ui/approval-card";

  const questions: ApprovalQuestion[] = [
    {
      q: "When should I migrate the bookings table (2.4M rows)?",
      type: "radio",
      options: [
        "Now, with a 40-second write lock",
        "Tonight at 02:00 UTC, the quietest hour",
        "Online in batches, about 25 minutes",
      ],
    },
    {
      q: "Where should it run first?",
      type: "check",
      options: ["Staging", "EU production", "US production"],
    },
    {
      q: "If a health check fails afterwards, what should I do?",
      type: "radio",
      options: [
        "Roll back automatically",
        "Pause and page Maya Chen",
        "Keep going and log it",
      ],
    },
  ];

  let index = $state(0);

  let cardState = $state<ApprovalState>("closed");
</script>

<ApprovalCard questions={questions} bind:index={index} bind:state={cardState} />
```

## Recipe

`approval-card.recipe.ts`:

```ts
import { tv, type VariantProps } from "../lib/tv";
import { glideLayer } from "../lib/glide";

/* approval-card — human-in-the-loop questions the agent asks before acting.
 * One question at a time. Every question sits in a vertical track; the viewport clips to the
 * active one and resizes to it while the track slides, so the swap reads as one move.
 * A single choice is a radio-group (layout="row"), a multi-select a list of checkbox rows; both
 * draw their own marks. Footer: a vertical pager (previous, rolling "1 / 3", next), ghost Skip
 * and accent Continue. Dismiss is a button; "Answers sent" is a status-pill with a mark.
 * The state prop: open | sent | closed. All three views stay in the DOM; `hidden` picks one.
 * Approve mode (the action prop) replaces the questions with one action to approve: its title,
 * description, command and details, an optional "Always allow" Checkbox in the footer and
 * Deny (ghost: no fill at rest, a secondary-filled pill read as a second button) / Approve (accent); deciding settles into an "Approved" (green) or "Denied"
 * (neutral) status-pill.
 *
 * Motion. A mount is not an arrival (`docs motion`): a plain mount shows the card at once.
 * It fades up when it arrives: on mount only with appear (the host's prop, for a card its code
 * adds live), and on every reopen. It fills backwards, not both: once in, the card rests on its own
 * opacity, which a pointer dismissal fades (the leaving variant, duration.fast; approval-card.logic.ts
 * afterFadeOut then hides it; from the keyboard and under reduced motion it is hidden at once).
 * Height, track and the pager's digit reel share duration.move + out-strong, so the card resizes,
 * the questions travel and the digit rolls as one object. The track rests in layout (a negative
 * margin, placeTrack), never on a transform; the transform only carries a move. The crossfade is
 * lighter (duration.base) and survives reduced motion. Dismiss, Start over and Open approval
 * are the real Button, marked data-approval-card="dismiss" | "reset" | "reopen"; the sent view and
 * the reopen button fade in (duration.base) once the card is gone; a single choice's options are the RadioGroup, marked
 * data-approval-card="options". */

export const approvalCard = tv({
  slots: {
    base: "relative w-full max-w-[320px] text-sm",
    status: "sr-only",
    card: [
      "relative overflow-hidden rounded-card bg-surface shadow-card",
      "animate-[fndn-fade-up_var(--fndn-duration-enter)_var(--fndn-easing-out-strong)_backwards]",
    ],
    /* on the Button (ghost sm square rounded muted): pinned top right */
    dismiss: "absolute top-2.5 end-2.5 z-2",
    body: "p-3",
    /* fndn-check-ok: the card has to change size between questions; there is no transform
     * equivalent, and it is kept to duration.move */
    viewport: "kbd-instant overflow-hidden motion-size-move",
    track: "kbd-instant relative flex flex-col gap-[26px] motion-transform-move",
    step: [
      "kbd-instant",
      "min-w-0 opacity-0 motion-opacity-base",
    ],
    /* author text takes its direction from its own first letter */
    question: "pe-7 text-md font-medium text-ink wrap-anywhere [unicode-bidi:plaintext]",
    /* on the RadioGroup, or the multi-select's own list (variant list) */
    options: "mt-2.5",
    highlight: glideLayer,
    /* approve mode (the action prop): the action described, then Approve / Deny. The heading is
     * the question part; then what it does, the exact command and its details. Nothing moves: the
     * card shows one decision, so there is no track to slide. */
    action: "flex min-w-0 flex-col gap-2",
    description: "m-0 text-sm text-ink-2 wrap-anywhere [unicode-bidi:plaintext]",
    /* the exact command, as the agent will run it: mono, wraps anywhere, reads left to right */
    command: [
      "m-0 px-2.5 py-2 rounded-control bg-inset text-start",
      "font-mono text-xs leading-5 text-ink whitespace-pre-wrap wrap-anywhere [direction:ltr]",
    ],
    details: "m-0 grid grid-cols-[auto_minmax(0,1fr)] gap-x-3 gap-y-1 text-xs leading-5",
    detail: "contents",
    detailLabel: "text-ink-2 whitespace-nowrap",
    /* a value keeps its own direction but sits on the page's side of its column, as its label does */
    detailValue: "m-0 min-w-0 text-ink wrap-anywhere [unicode-bidi:plaintext] [&:dir(ltr)]:text-left [&:dir(rtl)]:text-right",
    /* "Always allow": the real Checkbox where the pager sits in question mode, its box on the body's
     * 12px inset; its label may wrap */
    always: "min-w-0 ms-0.5",
    footer: "flex items-center justify-between gap-3 p-2.5",
    /* at the end, also when a single question has no pager before them */
    actions: "flex shrink-0 items-center gap-1.5 ms-auto -me-0.5",
    sent: "flex w-full items-center gap-3",
    /* on the Button (ghost sm muted), marked data-approval-card="reset" */
    reset: "shrink-0",
    /* on the Button (outline sm), marked data-approval-card="reopen" */
    reopen: "whitespace-nowrap",
  },
  variants: {
    /* set after the first render: the sent view and the reopen button fade in where the card was
     * (never on first paint; from the keyboard at once) */
    ready: {
      true: {
        sent: "kbd-instant starting:opacity-0 motion-opacity-base",
        reopen: "kbd-instant starting:opacity-0 motion-opacity-base",
      },
    },
    /* a detail value written in code (a path, a branch, a host) */
    mono: { true: { detailValue: "font-mono [direction:ltr]" } },
    /* the multi-select's checkbox rows: a column holding its glide layer */
    list: {
      true: { options: "relative flex flex-col" },
    },
    /* open | sent | closed: sent and closed replace the card with a pill or a reopen button */
    state: {
      open: {},
      sent: { base: "w-auto max-w-none" },
      closed: { base: "w-auto max-w-none" },
    },
    /* appear=false (the default) until the card has first been hidden: no entrance on mount (the adapter) */
    appear: { true: {}, false: { card: "animate-none" } },
    /* a pointer dismissal: the card fades out (duration.fast), then the host hides it */
    leaving: { true: { card: "opacity-0 pointer-events-none motion-opacity-fast" } },
    /* the question shown. Before the first measurement (data-measured, set on the root by the
     * adapter) only the active question exists. */
    active: {
      true: { step: "opacity-100" },
      false: { step: "[[data-slot=approval-card]:not([data-measured])_&]:hidden" },
    },
  },
});

export type ApprovalCardRecipeProps = VariantProps<typeof approvalCard>;
```
