---
title: "Blur Action Swap"
description: "Free React action swap for copy buttons: the label or icon swaps with blur, opacity and scale, like Copy to Copied. Framer Motion, Tailwind, 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/blur"
markdown: "https://beui.dev/components/motion/action-swap/blur.md"
license: "MIT"
---

# Blur Action Swap

> Free React action swap for copy buttons: the label or icon swaps with blur, opacity and scale, like Copy to Copied. Framer Motion, Tailwind, shadcn install.

## Install

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

## Dependencies

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

## Usage

### Blur usage

Copy-button style swap with blur, opacity and scale.

```tsx
"use client";

import { Check, Copy, Moon, Sun } from "lucide-react";
import { useState } from "react";
import {
  ActionSwapBlurButton,
  type ActionSwapItem,
} from "@/components/motion/action-swap-blur";

const TEXT_ITEMS: ActionSwapItem[] = [
  { id: "copy", label: "Copy" },
  { id: "copied", label: "Copied" },
];

const ICON_ITEMS: ActionSwapItem[] = [
  {
    id: "light",
    label: "Light",
    icon: <Sun className="h-4 w-4" />,
    ariaLabel: "Use light theme",
  },
  {
    id: "dark",
    label: "Dark",
    icon: <Moon className="h-4 w-4" />,
    ariaLabel: "Use dark theme",
  },
];

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 ActionSwapBlurPreview() {
  const [textValue, setTextValue] = useState(TEXT_ITEMS[0]?.id);
  const [iconValue, setIconValue] = useState(ICON_ITEMS[0]?.id);
  const [ctaValue, setCtaValue] = useState(CTA_ITEMS[0]?.id);

  return (
    <div className="flex flex-wrap items-center justify-center gap-3">
      <ActionSwapBlurButton
        items={TEXT_ITEMS}
        value={textValue}
        onValueChange={setTextValue}
        variant="secondary"
      />
      <ActionSwapBlurButton
        items={ICON_ITEMS}
        value={iconValue}
        onValueChange={setIconValue}
        variant="outline"
        size="icon"
        iconOnly
      />
      <ActionSwapBlurButton
        items={CTA_ITEMS}
        value={ctaValue}
        onValueChange={setCtaValue}
        variant="primary"
      />
    </div>
  );
}
```

## API Reference

### ActionSwapBlurButton

| 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 |

### ActionSwapBlurText

| 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. |

### ActionSwapBlurIcon

| 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

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

## Source

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