Popover
Displays rich content in a portal, triggered by a button.
Features
- Can be controlled or uncontrolled.
- Customise side, alignment, offsets, collision handling.
- Optionally render a pointing arrow.
- Focus is fully managed and customizable.
- Dismissing and layering behavior is highly customizable.
Install the component from your command line.
Import the components and piece the parts together.
Create your styled popover component from the primitive parts.
Contains all the parts of a popover.
Prop | Type | Default | Required |
---|---|---|---|
defaultOpen | boolean | ||
open | boolean | ||
onOpenChange | function |
The button that toggles the popover. By default, the Popover.Content
will position itself against the trigger.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button |
The component that pops out when the popover is open.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | div | |
trapFocus | boolean | true | |
onOpenAutoFocus | function | ||
onCloseAutoFocus | function | ||
disableOutsidePointerEvents | boolean | false | |
onEscapeKeyDown | function | ||
onPointerDownOutside | function | ||
onFocusOutside | function | ||
onInteractOutside | function | ||
disableOutsideScroll | boolean | false | |
portalled | boolean | true | |
forceMount | boolean | ||
anchorRef | ref | ||
side | enum | "bottom" | |
sideOffset | number | 0 | |
align | enum | "center" | |
alignOffset | number | 0 | |
avoidCollisions | boolean | true | |
collisionTolerance | boolean | 0 |
An optional arrow element to render alongside the popover. This can be used to help visually link the anchor with the Popover.Content
. Must be rendered inside Popover.Content
.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | svg | |
width | number | 10 | |
height | number | 5 | |
offset | number |
The button that closes an open popover.
Prop | Type | Default | Required |
---|---|---|---|
as | enum | button |
We expose a CSS custom property --radix-popover-content-transform-origin
. Use it to animate the content from its computed origin based on side
, sideOffset
, align
, alignOffset
and any collisions.
We expose data-side
and data-align
attributes. Their values will change at runtime to reflect collisions. Use them to create collision and direction-aware animations.
Adheres to the Dialog WAI-ARIA design pattern.
Key | Description |
---|---|
Space | Opens/closes the popover. |
Enter | Opens/closes the popover. |
Tab | Moves focus to the next focusable element |
Shift + Tab | Moves focus to the previous focusable element |
Esc | Closes the popover and moves focus to Popover.Trigger . |