Popover

An accessible popup anchored to a button.

API reference

Import the component and place its parts the following way:

Anatomy
import { Popover } from '@base-ui-components/react/popover';

<Popover.Root>
  <Popover.Trigger />
  <Popover.Portal>
    <Popover.Backdrop />
    <Popover.Positioner>
      <Popover.Popup>
        <Popover.Arrow />
        <Popover.Title />
        <Popover.Description />
        <Popover.Close />
      </Popover.Popup>
    </Popover.Positioner>
  </Popover.Portal>
</Popover.Root>

Root

Groups all parts of the popover. Doesn’t render its own HTML element.

PropTypeDefault
closeDelaynumber0
defaultOpenbooleanfalse
delaynumber300
onOpenChange(open, event, reason) => voidundefined
openbooleanundefined
openOnHoverbooleanfalse

Trigger

A button that opens the popover. Renders a <button> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-popup-open
data-pressed

Backdrop

An overlay displayed beneath the popover. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
keepMountedbooleanfalse
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-closed
data-ending-style
data-open
data-starting-style

Portal

A portal element that moves the popup to a different part of the DOM. By default, the portal element is appended to <body>.

PropTypeDefault
containerReact.Ref | HTMLElement | nullundefined
keepMountedbooleanfalse

Positioner

Positions the popover against the trigger. Renders a <div> element.

PropTypeDefault
align'start' | 'center' | 'end''center'
alignOffsetnumber0
anchor| React.Ref
| Element
| VirtualElement
| (() => Element | VirtualElement | null)
| null
undefined
arrowPaddingnumber5
classNamestring | (state) => stringundefined
collisionBoundary| 'clippingAncestors'
| Element
| Element[]
| Rect
'clipping-ancestors'
collisionPaddingnumber | Rect5
keepMountedbooleanfalse
positionMethod'absolute' | 'fixed''absolute'
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
side| 'bottom'
| 'inline-end'
| 'inline-start'
| 'left'
| 'right'
| 'top'
'bottom'
sideOffsetnumber0
stickybooleanfalse
Attribute
Description
data-anchor-hidden
data-open
data-side
data-unchecked
CSS Variable
Description
--anchor-height
--anchor-width
--available-height
--available-width
--transform-origin

A container for the popover contents. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
finalFocusReact.Refundefined
initialFocus| React.Ref
| (interactionType => HTMLElement | null)
undefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-closed
data-ending-style
data-open
data-side
data-starting-style

Arrow

Displays an element positioned against the popover anchor. Renders a <div> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined
Attribute
Description
data-anchor-hidden
data-open
data-side
data-uncentered
data-unchecked

Title

A heading that labels the popover. Renders an <h2> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Description

A paragraph with additional information about the popover. Renders a <p> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined

Close

A button that closes the popover. Renders a <button> element.

PropTypeDefault
classNamestring | (state) => stringundefined
render| React.ReactElement
| (props, state) => React.ReactElement
undefined