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.Controls the open state of the popover (controlled mode).
The initial open state in uncontrolled mode.
Callback fired when the open state changes.
Whether the popover is modal (blocks interaction with content behind it).
Whether to open the popover on hover instead of click.
Popover.Trigger
A button that opens the popover when activated.When true, merges props with the immediate child element instead of rendering a button.
Popover.Content
The popover content container with positioning logic.The preferred side of the trigger to render the popover.
The preferred alignment against the trigger.
The distance in pixels from the trigger.
The offset in pixels from the aligned edge.
The padding in pixels from the viewport edges for collision detection.
The sticky behavior of the popover during scrolling.
Whether to hide the popover when the trigger is fully occluded.
The element that receives focus when the popover opens.
The element that receives focus when the popover closes.
Additional CSS classes for the popover content.
Popover.Close
A button that closes the popover when clicked.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