卡片展开弹层

New

App Store 式卡片展开:卡片经共享 layoutId 直接变形为居中弹层,背景整页重模糊;扩展内容在表面落定后淡入,关闭时沿原路缩回原位并归还焦点。

安装

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

$ bunx --bun shadcn add @uilab/expanding-card

API 参考

title
ReactNode

Shown in both the collapsed card and the expanded modal; morphs continuously between them.

summary?
ReactNode

Shown in both states, under the title.

children
ReactNode

Expanded-only content — fades in once the card has landed.

expandHint?
string

Collapsed-state affordance text.

Expand
open?
boolean
defaultOpen?
boolean
false
onOpenChange?
((open: boolean) => void)
className?
string

Collapsed card.

modalClassName?
string

Expanded modal surface.

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.