眩光悬停

New

悬停时一道斜向光带扫过卡片或按钮表面。光色、角度、时长可调;触屏设备不渲染,「减少动效」偏好下换成轻微透明度高亮。

安装

用 shadcn CLI 添加,或手动复制源码。

$ bunx --bun shadcn add @uilab/glare-hover

API 参考

children
ReactNode

Content the glare sweeps across. Give it its own opaque background (card, button, image, …) — the wrapper only paints the glare layer.

className?
string
color?
string

Color of the light band. Defaults to a soft translucent white.

rgba(255, 255, 255, 0.55)
angle?
number

Angle of the sweeping band, in degrees.

-30
duration?
number

Duration of one sweep, in ms.

550
playOnce?
boolean

Play the sweep once on first hover instead of replaying on every hover.

false

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.