# Approve cascade

One approval for a whole batch: a line runs down the spine and checks each row as it arrives.

Also called: approve all, batch approval animation.

> chatcn Pro: needs a Pro license (https://chatcn.dev/pro). Install from the `@chatcn-pro` registry with your license token; setup at https://chatcn.dev/docs/chatcn-pro.

Example: One approval, every row. Approving a batch runs a green line down the spine; each ticked row checks the instant the line reaches it, and rows you left out stay hollow as it passes. Preview: https://chatcn.dev/preview/approve-cascade-demo

The rows hang off a single spine. Approve, and a green line runs down it; each ticked row checks the instant the line reaches it, a short cascade top to bottom, while rows you left out stay hollow as the line passes and say Skipped. The button counts the result. It reads as one approval that touched every row.

## Installation

```bash
npx shadcn@latest add @chatcn-pro/approve-cascade
```

## Usage

```tsx
import { ApproveCascade } from "@/components/ui/chatcn/pro/approve-cascade"

<ApproveCascade items={steps} selected={ids} onSelectedChange={setIds} approved={approved} onApprove={approve} />
```

## Props

| Prop | Type | Notes |
| --- | --- | --- |
| `items` | `{ id, label, detail? }[]` |  |
| `selected` / `onSelectedChange` | `string[]` | Rows you untick are skipped |
| `approved` / `onApprove` | `boolean` / `() => void` | Turning it on plays the cascade |
| `verb` / `doneLabel` | `string` | Default "Approve" and "approved" |

## Keyboard

| Key | Action |
| --- | --- |
| `Space` / `Enter` on a row | Tick or untick it |

## Accessibility

- Rows are `role="checkbox"` buttons with `aria-checked`; the button names the count.

## Motion

- The spine draws over (rows - 1) x 130 ms; each check pops 340 ms as the line arrives. Reduced motion: all check at once.

Source: https://chatcn.dev/docs/components/approve-cascade