Popover
- Alpha
- Not reviewed for accessibility
import {Popover} from '@primer/react'
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.
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.
Name | Type | Default | Description |
---|---|---|---|
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 | Style overrides to apply to the component. See also overriding styles. |
Name | Type | Default | Description |
---|---|---|---|
as | React.ElementType | div | Sets the underlying HTML tag for the component |
sx | SystemStyleObject | Style overrides to apply to the component. See also overriding styles. |