Basic
Floating contextual content.
Floating contextual content with collision handling and flexible positioning.
Import the component and configure it with the same props used in the playground.
Common patterns and practical usage examples.
Floating contextual content.
Positions content relative to the trigger.
Observes popover visibility from application state.
Modal interaction semantics.
Adds an arrow and an explicit close control inside the popover.
Positions content from an anchor while using a separate trigger.
Props available for the React Popover.
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | - | Popover trigger, anchor, content, and compound children. |
portal | boolean | true | Renders popover content through a portal. |
strategy | 'absolute' | 'absolute' | CSS positioning strategy used by floating content. |
open | boolean | - | Controlled open state. |
defaultOpen | boolean | - | Initial open state for uncontrolled usage. |
modal | boolean | false | Uses modal interaction semantics while the popover is open. |
onOpenChange | ( | - | Called when the open state changes. |
side | 'top' | 'bottom' | Preferred side for popover content relative to the anchor. |
align | 'start' | 'center' | Alignment along the chosen side. |
sideOffset | number | 8 | Distance between the anchor and popover content. |
collisionPadding | number | - | Padding used when avoiding viewport collisions. |
avoidCollisions | boolean | true | Allows the popover to flip or shift to stay visible. |
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | - | Trigger content. |
asChild | boolean | - | Composes trigger behavior onto a single child element. |
| Prop | Type | Default | Description |
|---|---|---|---|
asChild | boolean | - | Composes content behavior onto a single child element. |
initialFocus | RefObject< | - | Element that should receive focus when the popover opens. |
returnFocus | boolean | - | Restores focus to the trigger when the popover closes. |
closeOnEscape | boolean | - | Closes the popover when Escape is pressed. |
closeOnOutsidePress | boolean | - | Closes the popover when pressing outside the content. |
onEscapeKeyDown | ( | - | Called when Escape is pressed while the popover is open. |
onPointerDownOutside | ( | - | Called when a pointer down occurs outside popover content. |
onInteractOutside | ( | - | Called when an interaction occurs outside popover content. |
onOpenAutoFocus | ( | - | Called before focus moves into the popover after opening. |
onCloseAutoFocus | ( | - | Called before focus is restored after closing. |
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | - | Title text for popover content. |
asChild | boolean | - | Composes title behavior onto a single child element. |
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | - | Description text for popover content. |
asChild | boolean | - | Composes description behavior onto a single child element. |
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | - | Close button content. |
asChild | boolean | - | Composes close behavior onto a single child element. |
| Prop | Type | Default | Description |
|---|---|---|---|
align | 'center' | 'center' | Arrow alignment along the popover edge. |
offset | string | - | Arrow offset from the aligned edge. |
| Prop | Type | Default | Description |
|---|---|---|---|
childrenRequired | ReactNode | - | Element used as the positioning anchor. |
asChild | boolean | - | Composes anchor behavior onto a single child element. |
Guidance for accessible usage and interaction.
childrenopenonOpenChangemodalsidealignonOpenChangechildren