Popover
Popovers are interactive floating elements that display rich content, anchored to a trigger element when a user clicks or optionally hovers over it.
PopoverArrow API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverArrow = Popover.Arrow;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
hideWhenUncentered | bool | false | If |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverArrow
to change the default props of this component with the theme.PopoverBackdrop API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverBackdrop = Popover.Backdrop;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
container | HTML element | func | false | The container element to which the backdrop is appended to. |
keepMounted | bool | false | If |
render | element | func | - | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverBackdrop
to change the default props of this component with the theme.PopoverClose API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverClose = Popover.Close;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverClose
to change the default props of this component with the theme.PopoverDescription API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverDescription = Popover.Description;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverDescription
to change the default props of this component with the theme.PopoverPopup API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverPopup = Popover.Popup;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverPopup
to change the default props of this component with the theme.PopoverPositioner API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverPositioner = Popover.Positioner;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
alignment | 'center' | 'end' | 'start' | 'center' | The alignment of the popover popup element to the anchor element along its cross axis. |
alignmentOffset | number | 0 | The offset of the popover popup element along its alignment axis. |
anchor | HTML element | object | func | - | The element to which the popover popup element is anchored to. |
arrowPadding | number | 5 | Determines the padding between the arrow and the popover popup edges. Useful when the popover popup element has rounded corners via |
className | func | string | - | Class names applied to the element or a function that returns them based on the component's state. |
collisionBoundary | HTML element | Array<HTML element> | string | { height?: number, width?: number, x?: number, y?: number } | 'clippingAncestors' | The boundary that the popover popup element should be constrained to. |
collisionPadding | number | { bottom?: number, left?: number, right?: number, top?: number } | 5 | The padding between the popover popup element and the edges of the collision boundary to add whitespace between them to prevent them from touching. |
container | HTML element | func | - | The container element to which the popover positioner is appended to. |
hideWhenDetached | bool | false | Whether the popover popup element is hidden if it appears detached from its anchor element due to the anchor element being clipped (or hidden) from view. |
keepMounted | bool | false | Whether the popover popup remains mounted in the DOM while closed. |
positionStrategy | 'absolute' | 'fixed' | 'absolute' | The CSS position strategy for positioning the popover popup element. |
render | element | func | - | A function to customize rendering of the component. |
side | 'bottom' | 'left' | 'right' | 'top' | 'bottom' | The side of the anchor element that the popover popup element should be placed at. |
sideOffset | number | 0 | The gap between the anchor element and the popover popup element. |
sticky | bool | false | Whether to allow the popover to remain stuck in view while the anchor element is scrolled out of view. |
ref
is forwarded to the root element.Theme default props
You can usePopoverPositioner
to change the default props of this component with the theme.PopoverRoot API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverRoot = Popover.Root;
Props of the native component are also available.
Name | Type | Default | Description |
---|---|---|---|
animated | bool | true | Whether the tooltip can animate, adding animation-related attributes and allowing for exit animations to play. Useful to disable in tests to remove async behavior. |
closeDelay | number | 0 | The delay in milliseconds until the popover popup is closed when |
defaultOpen | bool | - | Specifies whether the popover is open initially when uncontrolled. |
delay | number | 300 | The delay in milliseconds until the popover popup is opened when |
delayType | 'hover' | 'rest' | 'rest' | The delay type to use when |
followCursorAxis | 'none' | 'x' | 'y' | 'none' | Determines which axis the tooltip should follow the cursor on. |
onOpenChange | func | - | Callback fired when the popover popup is requested to be opened or closed. Use when controlled. |
open | bool | - | If |
openOnHover | bool | false | If |
PopoverTitle API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverTitle = Popover.Title;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverTitle
to change the default props of this component with the theme.PopoverTrigger API
Import
import * as Popover from '@base_ui/react/Popover';
const PopoverTrigger = Popover.Trigger;
Props of the native component are also available.
Name | Type | Description |
---|---|---|
className | func | string | Class names applied to the element or a function that returns them based on the component's state. |
render | element | func | A function to customize rendering of the component. |
ref
is forwarded to the root element.Theme default props
You can usePopoverTrigger
to change the default props of this component with the theme.