Popover
Show anchored interactive content from click or hover.
Anatomy#
Content is portaled inside an internal positioning wrapper.
Usage#
Use Popover for anchored interactive content that does not need a labeled modal surface:
- Tooltip: brief, non-interactive hint.
- DropdownMenu: compact action list from a visible trigger.
- Dialog or Sheet: modal tasks that take over the page.
- BaseDialog: headless primitive to compose backdrop and content yourself.
Trigger modes and state#
Click toggles the popover by default. Use open, defaultOpen, and onOpenChange when the application coordinates visibility.
Set openOnHover to open when a mouse pointer enters the trigger or the trigger receives keyboard focus, and close closeDelay ms after the pointer or focus leaves both trigger and content (openDelay and closeDelay default to 100 ms). When openOnHover is enabled:
- Clicking the trigger only opens the popover.
- Touch hover is ignored.
- Outside focus no longer dismisses the content.
- Closing does not restore focus to the trigger unless
finalFocusis set.
Placement#
placement('top','right','bottom', or'left'; default'bottom') andalign('start','center', or'end'; default'center'): position the content relative to the trigger.gutterandoverflowPadding(both default to4px): set the gap to the trigger and the minimum distance from the viewport edge.flipandslide(both default totrue): flip to the opposite side whenplacementdoes not fit and slide along the trigger edge to stay inside the viewport. Read the active side fromdata-sideon the content.
Dismissal and accessibility#
Escape and outside interaction close a popover. Closing restores focus to the trigger, except after an outside press or focus move where focus has already moved elsewhere. Give Popover.Content an accessible name with aria-label when it has no visible heading.
closeOnEscape and closeOnOutsideClick control dismissal independently, and preventScroll locks body scroll while the popover is open.
Keyboard interaction#
Keyboard activation follows the trigger element. Escape requests dismissal when closeOnEscape allows it, and focusable controls inside the content participate in normal document focus order.
With openOnHover:
- ⇥ from the trigger moves into the open content.
- ⇥ from the last control inside the content moves to the next focusable element after the trigger.
- ⇧ + ⇥ from the first control returns to the trigger.
Examples#
Trigger modes#
Use click triggers for interactive panels and openOnHover for lightweight previews.
Accessible name#
Give content an accessible name when it has no visible title. Escape or an outside click closes the popover.
Hover trigger#
Use openOnHover instead of HoverCard when the preview holds controls
the user must reach, such as the Follow button here: Tab from the trigger moves into the card.
openDelay and closeDelay prevent flicker as the pointer moves between trigger and content.
Prevent dismissal#
closeOnEscape={false} and closeOnOutsideClick={false} block Escape and outside clicks.
onClosePrevented counts blocked attempts.
API Reference#
Attributes#
data-closeddata-disableddata-expandeddata-aligndata-sideProps#
Popover#
Trigger#
Renders a <button> element by default.
Content#
Props for `Popover.Content`. Renders a <div> element by default.
Close#
Renders a <button> element by default.