Profile
The shadcn demo as a polaroid: hover the link (or tab to it) and a small photo with handwriting on its margin lands next to it.
A small polaroid that appears when you rest the pointer on a link or move keyboard focus to it: photo stock with a thick lower margin for handwriting, a degree or two of tilt, and tape if you like. A preview for sighted pointer users, never the only home of anything.
npx shadcn@latest add @wobko/hover-card第一次使用?先把 registry 加进 components.json。 如何安装
The shadcn demo as a polaroid: hover the link (or tab to it) and a small photo with handwriting on its margin lands next to it.
The window holds any art: here a die-cut sticker, and the polaroid is taped down by a strip of washi across the top.
openDelay and closeDelay tune how eager the card is (the default 700 / 300 ms is deliberate: a card that pops up on every pass of the pointer is noise). `side` and `align` are Radix's: left and right cards start level with their link, so none rises above the page.
The real use: names in a paragraph that unfold into a card. Every mention is a real link that works without the card (touch, keyboard, no JS), and the card is a bonus for the pointer.
shadcn's `hover-card-demo`, written the way the original is: HoverCardContent with a width and ordinary children (an avatar, a name, a sentence and a date), none of the polaroid parts. The window is still a small photo-stock sheet, and it still only opens for a pointer.
The polaroid: a Paper on photo stock that is also the Radix hover card content (a CSS sheet, no SVG). It takes every Radix Content prop and these.
| 属性 | 类型 | 默认值 | 说明 |
|---|---|---|---|
| sideOffset | number | 8 | Gap between the trigger and the card (upstream's default is 4: a polaroid needs room for its shadow and tape). The card is also capped to the viewport width. |
| collisionPadding | number | Partial<Record<Side, number>> | 8 | Room kept between the card and the viewport edge when it has to shift to fit (upstream's default is 0). |
| stock | StockName | "photo" | What it is printed on. |
| tape | "corner" | "top" | "both" | false | false | Tape across the top edge or corners. |
| edge | EdgeSpec | "cut" | Cut (pure CSS), torn, deckle, ... |
| tilt | boolean | number | true | Seeded tilt of the sheet (photo stock turns up to 1.5 degrees); text stays upright. |
| seed | string | number | - | Pins the hand. |
CLI 会复制进你项目的文件。
正在加载源码