抽屉面板

从左侧或右侧弹簧滑入的侧边面板,带背景模糊、页面滚动锁定,支持 Esc 键关闭。

安装

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

$ bunx --bun shadcn add @uilab/drawer

API 参考

open
boolean
onOpenChange
(open: boolean) => void
side?
"left" | "right"
right
className?
string

Class for the panel surface.

backdropClassName?
string

Class for the backdrop.

ariaLabel?
string
dismissable?
boolean

Close when the backdrop is clicked. Default true.

true

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.