Dimensions
The shadcn demo on a slip with a push-pin through its top edge. A CSS sheet: it costs no SVG.
A slip of paper set down next to its trigger. It can be held with a push-pin or a strip of tape, given a hand-drawn arrow to point at what it is about, and cut from any stock. Focus moves into it, Escape puts it away.
npx shadcn@latest add @wobko/popoverFirst time here? Add the registry to components.json first. How to install
The shadcn demo on a slip with a push-pin through its top edge. A CSS sheet: it costs no SVG.
A felt-tip arrow points at the trigger, whichever side the popover opens on (Radix flips it near the edge of the screen). The arrow's height is added to sideOffset for you.
Any stock, held down by a pin of any color or by tape. A torn edge is drawn when the popover opens (the only case where it costs SVG).
A real use: a share popover with a read-only link and a copy button that confirms. Focus goes to the field, the link is selected on focus, Escape returns you to the trigger.
Official `popover-demo` with the same markup: a plain heading and paragraph, four label and input rows on a grid. The slip is a CSS sheet. Two small changes: the field ids are prefixed so they cannot clash with another example on the page, and the content is named for screen readers (a popover is a dialog).
The slip: a Paper that is also the Radix popover content (role=dialog, so give it a name with a title or `aria-label`). A CSS sheet, no SVG, unless a torn edge or the arrow is asked for. It takes every Radix Content prop (`side`, `align`, `sideOffset`, ...) and these.
| Prop | Type | Default | Description |
|---|---|---|---|
| sideOffset | number | 8 | Gap between the trigger and the slip (upstream's default is 4: a slip needs room for its shadow and pin). The slip is also capped to the viewport width. |
| collisionPadding | number | Partial<Record<Side, number>> | 8 | Room kept between the slip and the viewport edge when it has to shift to fit (upstream's default is 0: a wide slip touched the window). |
| pin | boolean | Accent | false | A push-pin through the top edge: `true` for tomato, or a stationery color (sky, lemon, grass ...). |
| arrow | boolean | false | A felt-tip arrow between the slip and the trigger. Radix turns it to whichever side the popover opened on and adds its height to `sideOffset`. |
| tape | "corner" | "top" | "both" | false | false | Strips of masking tape at the corners or the top edge. |
| stock | StockName | "slip" | What it is made of: slip, paper, kraft, sticky-*, index-card ... |
| edge | EdgeSpec | "cut" | Cut (pure CSS), torn, deckle, ... |
| tilt | boolean | number | true | Small seeded tilt of the sheet; text stays upright. |
| seed | string | number | - | Pins the hand. |
| data-slot | string | "popover-content" | For a component built on the popover to rename the slip (a combobox list is `combobox-content` in shadcn). The Command and Calendar that lie on a popover's paper look for `popover-content`, so keep it unless yours brings its own rules. |
The files the CLI copies into your project.
Loading the source