Popover

Use Modal to create an a11y-friendly popover dialog with configurable positioning.

Usage

<Popover
  renderContent={() => <Text p={4}>CONTENT HERE</Text>}
  placement='top'
  ariaLabel='Demo Popover'
  idx={1}
  width={370}
  overlayOpacity={0.3}
  trapFocus={true}
>
  <Button>Popover</Button>
</Popover>

Props

PropTypeDescription
idxstring, numberSet z-index of popover dialog
renderContentnodeChildren to render in the popover
ariaLabelstringApply an aria-label to the content of the popover dialog
overlayOpacitystringOpacity of the overlay rendered behind the popover dialog
placementstringWhere to position the popover relative to its trigger. Can be one of the values
trapFocusbooleanShould the popover trap focus inside its content when open
widthnumberWidth of the popover dialog, pixels
isOpenbooleanRender the popover dialog
openOnMountbooleanOpen the popover dialog when the trigger mounts
childrennodeRender a component that opens the popover dialog on click
onOpenfunctionCallback executed when the popover opens
onClosefunctionCallback executed when the popover closes
hideOverlaybooleanDo not render the semi-opaque overlay behind the popover

Placement values

Popover supports the same placement values as the underlying Popper library.

type Placement =
  | 'auto'
  | 'auto-start'
  | 'auto-end'
  | 'top'
  | 'top-start'
  | 'top-end'
  | 'bottom'
  | 'bottom-start'
  | 'bottom-end'
  | 'right'
  | 'right-start'
  | 'right-end'
  | 'left'
  | 'left-start'
  | 'left-end'