Skip to content

Popover

The Popover component provides a non-modal dialog that floats over other content, typically used to display supplementary information, complex forms, or interactive elements when a user clicks or hovers over a specific trigger. It’s similar to a tooltip but supports richer, more interactive content.

Add the Popover component and its sub-components to your project using the OrbitUI CLI:

Terminal window
npx orbitkit@latest add popover

Import the Popover and PopoverContent components. Place your trigger element (e.g., a Button) directly inside the Popover component and add the data-trigger attribute to it. The PopoverContent will contain the rich content that appears in the popover.

The Popover system consists of two main components, each with its own set of props:

The Popover component serves as the main wrapper for the popover system. It manages the popover’s open/closed state.

This component primarily acts as a container and doesn’t accept explicit props. Its functionality is driven by a client-side JavaScript initialization script.

The PopoverContent component contains the actual content displayed within the popover. It also controls the popover’s positioning and appearance.

PropTypeDefault
sidetop, bottom, left, rightbottom
alignmentstart, center, endstart
sideOffsetnumber2
arrowbooleanfalse
  • side: Defines the primary position of the tooltip relative to the element that triggers it.
  • alignment: Defines how the tooltip is aligned horizontally or vertically in relation to the triggering element.
  • sideOffset: The distance in pixels between the trigger and the tooltip content.
  • arrow: a small arrow pointing to the trigger will be rendered on the tooltip.

This component accepts all the standard HTML attributes that a <div> element would.