logo

SINGULARITY

DOCS

PurchaseReturn to the Dashboard
Reference

Popover

A Popover is designed to overlay content on top of another element.

Key information to understand when utilizing the Popover component:
  • The component is constructed upon the Modal component.
  • Unlike the Popper component, it prevents scrolling and clicking outside the popover.

Basic Popover

Anchor playground

Adjust the anchorOrigin and transformOrigin positions using radio buttons. You can also configure the anchorReference to either anchorPosition or anchorEl. When set to anchorPosition, the component references the anchorPosition prop instead of anchorEl, allowing you to customize the popover's position.

Mouse hover interaction

This example illustrates how to implement the Popover component with mouseenter and mouseleave events to create interactive popover behavior.

Hover with a Popover.

Virtual element

The anchorEl prop can reference a virtual DOM element. You must provide an object adhering to the following interface:
interface PopoverVirtualElement {
  nodeType: 1;
  getBoundingClientRect: () => DOMRect;
}
Select a portion of the text to trigger the popover:

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam ipsum purus, bibendum sit amet vulputate eget, porta semper ligula. Donec bibendum vulputate erat, ac fringilla mi finibus nec. Donec ac dolor sed dolor porttitor blandit vel vel purus. Fusce vel malesuada ligula. Nam quis vehicula ante, eu finibus est. Proin ullamcorper fermentum orci, quis finibus massa. Nunc lobortis, massa ut rutrum ultrices, metus metus finibus ex, sit amet facilisis neque enim sed neque. Quisque accumsan metus vel maximus consequat. Suspendisse lacinia tellus a libero volutpat maximus.

For additional details on the properties of virtual elements, consult the following resources:
:::warning When using a virtual element with the Popover component, the nodeType property is required. This differs from virtual elements used in the Popper or Tooltip components, which do not mandate this property. :::

Supplementary projects

For advanced scenarios, you may benefit from exploring:

material-ui-popup-state

starsnpm downloads
The material-ui-popup-state package simplifies popover state management in most use cases.