Action Swap
Documentation Index
Fetch the complete documentation index at: /llms.txt. Use this file to discover all available pages before exploring further.
Cycle an action's label and icon with blur, roll, or letter-cascade transitions.
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: "on", label: "Notifications on" },
{ id: "off", label: "Notifications off" },
]
<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.