按钮

带弹簧按压反馈的按钮,还包含状态按钮 StatefulButton(空闲 → 加载中 → 成功 / 失败)与磁吸按钮 MagneticButton。

基础按钮

base.tsx

按压缩放、悬停上浮,支持多种样式与尺寸。

安装

$ bunx --bun shadcn add @uilab/button-base

API 参考

className?
string
variant?
"primary" | "secondary" | "ghost" | "outline"
primary
size?
"sm" | "md" | "lg" | "icon"
md
pressScale?
number
0.93
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

false

状态按钮

stateful.tsx

空闲 → 加载中 → 成功 / 失败状态切换,内容以模糊过渡方式替换,宽度随之变形。

安装

$ bunx --bun shadcn add @uilab/button-stateful

API 参考

className?
string
variant?
"primary" | "secondary" | "ghost" | "outline"
size?
"sm" | "md" | "lg" | "icon"
pressScale?
number
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

icon?
ReactNode
state?
"idle" | "loading" | "success" | "error"
idle
loadingText?
ReactNode
Loading
successText?
ReactNode
Done
errorText?
ReactNode
Try again

磁吸按钮

magnetic.tsx

由 Magnetic 包裹组成的按钮,能被光标吸引产生跟随位移。

安装

$ bunx --bun shadcn add @uilab/button-magnetic

API 参考

className?
string
variant?
"primary" | "secondary" | "ghost" | "outline"
size?
"sm" | "md" | "lg" | "icon"
pressScale?
number
ripple?
boolean

Spawn a Material-style ripple from the press point. Off by default.

strength?
number

Magnetic pull strength. Default 0.25.

0.25
magneticClassName?
string

Class applied to the magnetic wrapper.

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.