Action Swap

Buttons and slots that change their label or icon in place, for copy-to-clipboard, follow/unfollow or play/pause controls. ActionSwapButton steps through items on click; ActionSwapText and ActionSwapIcon swap content you control using blur, roll or per-letter cascade transitions.

Cascade

action-swap-cascade.tsx

Each letter of the outgoing label falls away while its replacement lands in the same slot, travelling left to right, so a change like Copy to Copied reads as one motion.

Action Swap Cascade preview width

Install

$ bunx --bun shadcn add @karaui/action-swap-cascade
@karaui not found? Add it to components.json
{
  "registries": {
    "@karaui": "https://karaui.kamisama-v0.my.id/r/{name}.json"
  }
}

@karaui is in shadcn's public registry directory, so the latest CLI needs no setup. On an older CLI, merge this into the existing file once and every @karaui/… install resolves.

API Reference

ActionSwapCascadeButton

value?
string
—
defaultValue?
string
—
className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
—
size?
"sm" | "md" | "lg" | "icon"
—
items
ActionSwapItem[]
—
onValueChange?
((value: string, item: ActionSwapItem) => void)
—
iconOnly?
boolean
—
cycle?
boolean
—

ActionSwapCascadeText

value
string
—
className?
string
—

ActionSwapCascadeIcon

value
string
—
className?
string
—

Blur

action-swap-blur.tsx

The old content blurs, fades and shrinks while the new content grows in sharp: the familiar copy-to-check feedback.

Action Swap Blur preview width

Install

$ bunx --bun shadcn add @karaui/action-swap-blur

API Reference

ActionSwapBlurButton

value?
string
—
defaultValue?
string
—
className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
—
size?
"sm" | "md" | "lg" | "icon"
—
items
ActionSwapItem[]
—
onValueChange?
((value: string, item: ActionSwapItem) => void)
—
iconOnly?
boolean
—
cycle?
boolean
—

ActionSwapBlurText

value
string
—
className?
string
—

ActionSwapBlurIcon

value
string
—
className?
string
—

Roll

action-swap-roll.tsx

The current label or icon slides up and out as its successor comes up from underneath, softened by a light blur.

Action Swap Roll preview width

Install

$ bunx --bun shadcn add @karaui/action-swap-roll

API Reference

ActionSwapRollButton

value?
string
—
defaultValue?
string
—
className?
string
—
variant?
"primary" | "secondary" | "ghost" | "outline"
—
size?
"sm" | "md" | "lg" | "icon"
—
items
ActionSwapItem[]
—
onValueChange?
((value: string, item: ActionSwapItem) => void)
—
iconOnly?
boolean
—
cycle?
boolean
—

ActionSwapRollText

value
string
—
className?
string
—

ActionSwapRollIcon

value
string
—
className?
string
—

Updated