The Popover component displays floating content in relation to a target. Popovers appear either at the top, bottom, left or right of their target. The preferred and default side is the bottom. Popovers use smart positioning if there is not enough space.

Implementation details

The Popover uses the Positioner from Evergreen to handle the positioning logic. Internally the Popover will make sure the Popover is positioned within the viewport. This means that sometimes the Popover flips — or the Popover might move slightly to the left or right.

When creating a Popover, you must specify both:

  • Its content, by setting the content prop, and
  • Its target, as a single child element or a function

When you pass a function to the content prop you will be able to close the popover inside of the content.

Popovers Close On

  • Outside click
  • Escape key
  • The close function being called (advanced)

Basic usage

Hide code

Focus management with

When opening the Popover when bringFocusInside is true, focus will be brought inside the Popover by looking for elements with [autofocus] first, [tabindex] second and button last.

When passing a node as the Popover children, the Popover will handle focus management automatically when closing the Popover. When closing, it will return back focus on the target if nothing else has focus.

Hide code

Close from within content

Hide code

Positioning the Popover

The Popover can be positioned on the following positions using the position prop:

  • Position.TOP
  • Position.TOP_LEFT
  • Position.TOP_RIGHT
  • Position.BOTTOM
  • Position.BOTTOM_LEFT
  • Position.BOTTOM_RIGHT
  • Position.LEFT
  • Position.RIGHT

Disable Close on Body Click

Hide code

Popover Props

positionPosition.TOP | Position.TOP_LEFT | Position.TOP_RIGHT | Position.BOTTOM | Position.BOTTOM_LEFT | Position.BOTTOM_RIGHT | Position.LEFT | Position.RIGHT
The position the Popover is on. Smart positioning might override this.
When true, the Popover is manually shown.
trigger'click' | 'hover'
Open the Popover based on click or hover. Default is click.
contentnode | funcrequired
The content of the Popover.
childrenelement | funcrequired
The target button of the Popover. When a function the following arguments are passed: ({ toggle: Function -> Void, getRef: Function -> Ref, isShown: Bool })
The display property passed to the Popover card.
minWidthnumber | string
The min width of the Popover card.
minHeightnumber | string
The min height of the Popover card.
Properties passed through to the Popover card.
Duration of the animation.
Function called when the Popover opens.
Function fired when Popover closes.
Function that will be called when the enter transition is complete.
Function that will be called when the exit transition is complete.
Function that will be called when the body is clicked.
When true, bring focus inside of the Popover on open.
Boolean indicating if clicking outside the dialog should close the dialog.