action-swap-demo
Overview
Use Action Swap when one compact control moves through a small, predictable set of related modes. The button can animate its label, icon, or both while preserving a stable hit target.
Installation
Usage
import { ActionSwapButton } from "@/components/animated/action-swap"
const items = [
{ id: "digest", label: "Daily digest" },
{ id: "paused", label: "Digest paused" },
]
<ActionSwapButton items={items} animation="cascade" />Use ActionSwapText and ActionSwapIcon directly when another control owns the interaction. The action-swap-blur, action-swap-roll, and action-swap-cascade entry points provide fixed-animation wrappers.
Accessibility
Keep every state label specific. Icon-only items need an ariaLabel. Reduced-motion users receive an immediate, legible state change without the full transition.