Popover
A small panel of content or controls, anchored to what opened it.
{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}
A small panel of content or controls, anchored to what opened it.
Import
import { Popover, PopoverTrigger, PopoverAnchor, PopoverContent, PopoverHeader, PopoverTitle, PopoverDescription, PopoverClose } from "@ir/ui";Watch out
sideOffsetis 8, which Figma does not specify — a floating panel's distance from its trigger is not something a static frame can show. 8 matches what Select already uses for its menu.
Props
| Prop | Type | Required | What it does |
|---|---|---|---|
surface | boolean | Off for content that is already a surface of its own — a Calendar, say, which draws its own card, border and padding. Two cards nested inside each other produce a double border and doubled inset, and stripping the outer one from the call site is what no-restyle refuses (rightly), so it is a prop instead. Positioning, portalling and z-index stay; only the card goes. |
Do and don't
Use Tooltip for explaining, Popover for content you interact with.
Don't — Use a popover for a one-line explanation on hover.
A popover takes focus and waits to be dismissed. That is too much ceremony for a sentence.
Use Dialog when the answer matters and the page must wait.
Don't — Put a destructive confirmation in a popover.
A popover closes when you click away, so "are you sure?" can be dismissed by accident.
Add PopoverHeader with a title, or an aria-label on the content.
Don't — Open a panel of controls with no title.
Radix does not name a popover for you the way it does a dialog. Without one a screen reader announces an unnamed group.
Let the trigger be the anchor, or use PopoverAnchor deliberately.
Don't — Anchor to a container when a specific control opened it.
A panel that appears away from the thing you clicked reads as unrelated to it.
Put the second step in the same panel, or use a dialog.
Don't — Open a popover from inside a popover.
Stacked dismiss-on-outside-click layers make Escape ambiguous and strand focus.
Accessibility
- The panel points aria-labelledby and aria-describedby at its title and description, but only when those parts are actually present. A popover with neither is unnamed, which is correct for one that holds a single control.
- Both ids come from useId, so two popovers on a page never collide.
- Radix handles focus movement into the panel and back to the trigger on close; do not manage focus yourself.
Where it is drawn
Figma — structure from figma, measurements from figma.