Popover

A popover displays additional content when a user interacts with a trigger element.

Anatomy

Composed Components

A Popover uses the following components.

Usage

Disabled

A popover will not open when its trigger is disabled.

Single button

A popover can have a single button.

Multiple buttons

A popover can have a group of buttons.

A popover can have footer text.

Placement

A popover can be positioned in different ways top, right, bottom, left.

Context

A Popover's isOpen state or close function can be retrieved from PopoverContext and ButtonContext.

Controlled

A Popover's open state can be handled in controlled mode.

Props

Popover

isAutoWidth?

Whether the popover should have an auto width. Only available in non-dialog popovers.

boundaryOffset?

The minimum distance the trigger edge should be from the edge of the overlay element.

isNonDialog?

Whether the popover is a non-dialog. This is set to true in components such as selects.

containerProps?

The props of the popover's inner container.

placement?

The placement of the popover with respect to its anchor element.

Defaults to bottom.
style?

The inline style for the element. A function may be provided to compute the style based on component state.

isOpen?

Whether the overlay is open by default (controlled).

containerPadding?

The placement padding that should be applied between the element and its surrounding container.

Defaults to 12.
offset?

The additional offset applied along the main axis between the element and its anchor element.

Defaults to 8.
crossOffset?

The additional offset applied along the cross axis between the element and its anchor element.

Defaults to 0.
shouldFlip?

Whether the element should flip its orientation (e.g. top to bottom or left to right) when there is insufficient room for it to render completely.

Defaults to true.
triggerRef?

The ref for the element which the popover positions itself with respect to.

When used within a trigger component such as DialogTrigger, MenuTrigger, Select, etc., this is set automatically. It is only required when used standalone.

trigger?

The name of the component that triggered the popover. This is reflected on the element as the data-trigger attribute, and can be used to provide specific styles for the popover depending on which element triggered it.

isEntering?

Whether the popover is currently performing an entry animation.

isExiting?

Whether the popover is currently performing an exit animation.

UNSTABLE_portalContainer?

The container element in which the overlay portal will be placed. This may have unknown behavior depending on where it is portalled to.

Defaults to document.body.
defaultOpen?

Whether the overlay is open by default (uncontrolled).

onOpenChange?

Handler that is called when the overlay's open state changes.

children?

The children of the component. A function may be provided to alter the children based on component state.

className?

The CSS className for the element. A function may be provided to compute the class based on component state.

PopoverTrigger

isOpen?

Whether the overlay is open by default (controlled).

defaultOpen?

Whether the overlay is open by default (uncontrolled).

onOpenChange?

Handler that is called when the overlay's open state changes.

Migration Notes

Coming from Orbiter, you should be aware of the following changes:

  • The position property has been renamed placement.