操作切换器

用于按钮文字与图标切换的 CTA 按钮及插槽原语,切换时带模糊过渡动效。

瀑布流切换

action-swap-cascade.tsx

逐字符老虎机式滚动切换——旧文案的字母依次掉落,新字母从左到右落位。

安装

$ bunx --bun shadcn add @uilab/action-swap-cascade

API 参考

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

模糊切换

action-swap-blur.tsx

类似复制按钮的切换效果,结合模糊、透明度与缩放变化。

安装

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

API 参考

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

滚动切换

action-swap-roll.tsx

新的文字或图标从下方带模糊滚入。

安装

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

API 参考

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

Keep in mind

Some components on this site are inspired by or recreated from existing work across the web. I'm not here to take credit; just to learn, experiment, and sometimes push things a bit further. If something looks familiar and I forgot to mention you, reach out and I'll fix that right away.