---
title: "Cascade Action Swap"
description: "Free React action swap: the old button label drops away letter by letter as the new one lands, left to right. For copy and save states. shadcn install."
category: "Components"
parent: "https://beui.dev/components/motion/action-swap"
publishedAt: "2026-06-10"
updatedAt: "2026-10-18"
documentation: "https://beui.dev/components/motion/action-swap/cascade"
markdown: "https://beui.dev/components/motion/action-swap/cascade.md"
license: "MIT"
---

# Cascade Action Swap

> Free React action swap: the old button label drops away letter by letter as the new one lands, left to right. For copy and save states. shadcn install.

## Install

```bash
npx shadcn@latest add @beui/action-swap-cascade
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

### Cascade usage

Letter-by-letter slot roll: the old label's letters drop away as the new ones land, left to right.

```tsx
"use client";

import { Check, Copy } from "lucide-react";
import {
  ActionSwapCascadeButton,
  type ActionSwapItem,
} from "@/components/motion/action-swap-cascade";

const CTA_ITEMS: ActionSwapItem[] = [
  {
    id: "copy",
    label: "Copy link",
    icon: <Copy className="h-4 w-4" />,
    ariaLabel: "Copy link",
  },
  {
    id: "copied",
    label: "Copied!",
    icon: <Check className="h-4 w-4" />,
    ariaLabel: "Copied",
  },
];

export function ActionSwapCascadePreview() {
  return (
    <div className="flex w-full justify-center">
      <ActionSwapCascadeButton items={CTA_ITEMS} variant="primary" />
    </div>
  );
}
```

## API Reference

### ActionSwapCascadeButton

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `className` | `string` | — | No | Classes merged onto the root element. |
| `defaultValue` | `string` | — | No | The initial item id when uncontrolled. Default: the first item. |
| `value` | `string` | — | No | The id of the shown item, for controlled use. |
| `size` | `"sm" \| "md" \| "lg" \| "icon"` | — | No | Button height and padding. Default: "md" |
| `onValueChange` | `((value: string, item: ActionSwapItem) => void)` | — | No | Called with the next item's id and the item when a press advances it. |
| `variant` | `"outline" \| "primary" \| "secondary" \| "ghost"` | — | No | Visual style of the button. Default: "secondary" |
| `items` | `ActionSwapItem[]` | — | Yes | States the button steps through, each with a label and optional icon. |
| `iconOnly` | `boolean` | — | No | Show only the icon and use the label as the accessible name. Default: true for size "icon" |
| `cycle` | `boolean` | — | No | Advance to the next item on each press, wrapping at the end. Default: true |

### ActionSwapCascadeText

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `className` | `string` | — | No | Classes merged onto the root element. |
| `value` | `string` | — | Yes | Key for the current text; a new value plays the swap. |

### ActionSwapCascadeIcon

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `className` | `string` | — | No | Classes merged onto the root element. |
| `value` | `string` | — | Yes | Key for the current icon; a new value plays the swap. |

## Types

### ActionSwapItem

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `id` | `string` | Yes | Unique key, used as the button's value. |
| `label` | `ReactNode` | Yes | Text shown on the button while this item is active. Hidden when `iconOnly`. |
| `icon` | `ReactNode` | No | Icon shown before the label while this item is active. |
| `ariaLabel` | `string` | No | Accessible name while active. Falls back to a string label when `iconOnly`. |

## More in Action Swap

- [Blur Action Swap](https://beui.dev/components/motion/action-swap/blur.md)
- [Roll Action Swap](https://beui.dev/components/motion/action-swap/roll.md)

## Source

- Registry detail: https://beui.dev/r/action-swap-cascade
- Raw source: https://beui.dev/r/action-swap-cascade/raw
- GitHub: https://github.com/starc007/ui-components
