Popover

An accessible popup anchored to a button.

API reference

Import the component and assemble its parts:

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
defaultOpen

boolean

false

open

boolean

undefined

onOpenChange

(open, event, reason) => void

undefined

openOnHover

boolean

false

delay

number

300

closeDelay

number

0

Trigger

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

PropTypeDefault
className

string | (state) => string

undefined

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
className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-starting-style
data-ending-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
container

React.Ref | HTMLElement | null

undefined

keepMounted

boolean

false

Positioner

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

PropTypeDefault
align

'start' | 'center' | 'end'

'center'

alignOffset

number

0

side

| 'bottom'
| 'inline-end'
| 'inline-start'
| 'left'
| 'right'
| 'top'

'bottom'

sideOffset

number

0

arrowPadding

number

5

anchor

| React.Ref
| Element
| VirtualElement
| (() => Element | VirtualElement | null)
| null

undefined

collisionBoundary

| 'clipping-ancestors'
| Element
| Element[]
| Rect

'clipping-ancestors'

collisionPadding

number | Rect

5

sticky

boolean

false

positionMethod

'absolute' | 'fixed'

'absolute'

className

string | (state) => string

undefined

keepMounted

boolean

false

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-anchor-hidden
data-side
CSS Variable
Description
--anchor-height
--anchor-width
--available-height
--available-width
--transform-origin

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

PropTypeDefault
initialFocus

| React.Ref
| (interactionType => HTMLElement | null)

undefined

finalFocus

React.Ref

undefined

className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-side
data-starting-style
data-ending-style

Arrow

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

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Attribute
Description
data-open
data-closed
data-uncentered
data-anchor-hidden
data-side

Title

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

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Description

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

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined

Close

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

PropTypeDefault
className

string | (state) => string

undefined

render

| React.ReactElement
| (props, state) => React.ReactElement

undefined