Skip to content

Popover

Alpha
Use Popovers to bring attention to specific user interface elements and suggest an action or to guide users through a new experience
import {Popover} from '@primer/react'

Examples

Two components make up a popover; the Popover component controls the absolute positioning of the popover, and Popover.Content renders the inner content of the popover as well as the caret.

By default, the popover renders with absolute positioning, meaning it should usually be wrapped in an element with a relative position in order to be positioned properly. To render the popover with relative positioning, use the relative property.

It can be useful to give the Popover.Content element a margin to help align the popover.

Caret position

Popover supports various caret positions, which you can specify via the caret property. This demo shows all the valid values for the prop. The default is top. Note that the top-left, bottom-left, top-right, and bottom-right values modify the horizontal alignment of the popover.

Props

Popover

NameTypeDefaultDescription
as
string
divSets the underlying HTML tag for the component
caret
| 'top'
| 'bottom'
| 'left'
| 'right'
| 'bottom-left'
| 'bottom-right'
| 'top-left'
| 'top-right'
| 'left-bottom'
| 'left-top'
| 'right-bottom'
| 'right-top'
  
'top'Controls the position of the caret
open
boolean
falseControls the visibility of the popover.
relative
boolean
falseSet to true to render the popover using relative positioning.
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

Popover.Content

NameTypeDefaultDescription
as
string
divSets the underlying HTML tag for the component
sx
SystemStyleObject
Style overrides to apply to the component. See also overriding styles.

Status

Alpha

  • Component props are documented on primer.style/react.
  • Component does not have any unnecessary third-party dependencies.
  • Component can adapt to different themes.
  • Component can adapt to different screen sizes.
  • Component has 100% test coverage.

Beta

  • Component is used in a production application.
  • Common usage examples are documented on primer.style/react.
  • Common usage examples are documented in storybook stories.
  • Component has been reviewed by a systems designer and any resulting issues have been addressed.
  • Component has been manually reviewed by the accessibility team and any resulting issues have been addressed.

Stable

  • Component API has been stable with no breaking changes for at least one month.
  • Feedback on API usability has been sought from developers using the component and any resulting issues have been addressed.
  • Component has corresponding design guidelines documented in the interface guidelines.
  • Component has corresponding Figma component in the Primer Web library.
Edit this page on GitHub
6 contributorsmperrottirezrahcolebemisjfuchsVanAndersonBinaryMuse
Last edited by mperrotti on March 16, 2022