Overview
Popover displays floating content anchored to a trigger element. It includes smart positioning with collision detection, automatic focus management, and keyboard navigation.Basic usage
Components
Popover (Root)
The root component that manages popover state and positioning context.boolean
Controls the open state of the popover (controlled mode).
boolean
The initial open state in uncontrolled mode.
(open: boolean) => void
Callback fired when the open state changes.
boolean
default:"false"
Whether the popover is modal (blocks interaction with content behind it).
boolean
Whether to open the popover on hover instead of click.
Popover.Trigger
A button that opens the popover when activated.boolean
When true, merges props with the immediate child element instead of rendering a button.
Popover.Content
The popover content container with positioning logic.'top' | 'right' | 'bottom' | 'left'
default:"'bottom'"
The preferred side of the trigger to render the popover.
'start' | 'center' | 'end'
default:"'center'"
The preferred alignment against the trigger.
number
default:"4"
The distance in pixels from the trigger.
number
The offset in pixels from the aligned edge.
number
default:"3"
The padding in pixels from the viewport edges for collision detection.
'partial' | 'always'
The sticky behavior of the popover during scrolling.
boolean
Whether to hide the popover when the trigger is fully occluded.
number | React.RefObject
The element that receives focus when the popover opens.
React.RefObject
The element that receives focus when the popover closes.
string
Additional CSS classes for the popover content.
Popover.Close
A button that closes the popover when clicked.boolean
When true, merges props with the immediate child element instead of rendering a button.
Usage examples
Positioned popover
With custom offset
Hover trigger
Controlled popover
With close button
Modal popover
Positioning
The Popover uses smart positioning logic:- Preferred side: Set via the
sideprop - Collision detection: Automatically flips to the opposite side if there isn’t enough space
- Alignment: Control via the
alignprop (start,center,end) - Offsets: Fine-tune position with
sideOffsetandalignOffset
Accessibility features
- Keyboard navigation: Arrow keys to navigate, Enter/Space to activate
- ESC to close: Press Escape to close the popover
- Focus management: Automatic focus handling with
initialFocusandfinalFocusprops - Focus return: Focus returns to the trigger when closed
- ARIA attributes: Proper ARIA relationships between trigger and content
- Screen reader support: Announces popover state changes
Trigger patterns
ThePopover.Trigger component supports two usage patterns:
- Default button: Renders a button when no children provided or
asChildis false - Custom trigger: Use
asChildto merge popover functionality with your component