Popover

Use Popovers to bring attention to specific user interface elements and suggest an action or to guide users through a new experience
  • Alpha
  • Not reviewed for accessibility
This documentation is moving to a new home. Please update any link or bookmark that points to this page. The new content can be found here.
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
React.ElementType
div

Sets 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
false

Controls the visibility of the popover.

relative
boolean
false

Set to true to render the popover using relative positioning.

sx
SystemStyleObject

Popover.Content

NameTypeDefaultDescription
as
React.ElementType
div

Sets the underlying HTML tag for the component

sx
SystemStyleObject

Status

Alpha

  • Component props and basic example usage of the component 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 robust unit test coverage (100% where achievable).
  • Component has visual regression coverage of its default and interactive states.
  • Component does not introduce any axe violations.
  • Component has been manually reviewed by the accessibility team and any resulting issues have been addressed.

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 does not introduce any performance regressions.

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.
  • Tooling (such as linters, codemods, etc.) exists to prevent further use of alternatives.