Demos

A popover that explains a term.

Usage

Use a popover for extra detail or a small control that the reader opens on purpose: a definition, a date picker, a short filter. For a one-line label on hover, use a Tooltip. For a task that blocks the page, use a Dialog.

Import it from @workspace/ui/components/popover.

Anatomy

  • Popover — Holds the open state.
  • PopoverTrigger — Opens the popover on click.
  • PopoverContent — The floating panel. Sets placement.
  • PopoverHeader — Stacks the title and description.
  • PopoverTitle — The panel heading.
  • PopoverDescription — Muted body text.

Notes

  • The popover flips to the other side when there is no room.
  • Escape and a click outside close it.
  • Pass a button through render on the trigger to reuse the Button styles.

Examples

Placement

Use side to pick which side of the trigger it opens on.

Alignment

align lines the popover up with the start, center, or end of its trigger.

With form

A popover can hold a small form, such as setting a target value.

Props

These are the props you set most often. Unlisted props pass through to the underlying element.

Popover

PropTypeDefaultDescription
defaultOpenbooleanfalseOpen on first render.
openboolean—Open state when controlled.
onOpenChange(open) => void—Called when the popover opens or closes.

PopoverContent

PropTypeDefaultDescription
side"top", "right", "bottom", "left", "inline-start", or "inline-end"bottomSide of the trigger to open on.
align"start", "center", or "end"centerAlignment along that side.
sideOffsetnumber4Gap from the trigger in pixels.
alignOffsetnumber0Shift along the side in pixels.
classNamestring—Classes merged onto the panel.