Skip to main content

Popover

A non-modal panel anchored to a trigger.

Columns Share …
<mm-popover label="Column options">
<mm-button slot="trigger" variant="secondary" icon="view-column">Columns</mm-button>
<mm-checkbox checked label="Owner"></mm-checkbox>
<mm-checkbox checked label="Rows"></mm-checkbox>
</mm-popover>

<!-- Or point at a trigger elsewhere; place the popover right after it so Tab reaches the content. -->
<mm-button id="share" variant="secondary" icon="share">Share</mm-button>
<mm-popover for="share" label="Share orders_daily">…</mm-popover>

Guidance​

Popovers hold a small piece of interactive content next to its trigger: a filter form, column options, a share list. The panel is a raised layer (mm-raised, radius-md, shadow-float) with square, simple edges and no arrow, positioned against the trigger and flipped to stay on screen. It uses the native popover="auto" attribute, so it sits in the top layer, a click outside closes it, and only one auto popover is open at a time.

Wrap the trigger in the trigger slot, or point for at the id of a trigger in the same document or shadow root, or set anchor to an element. The trigger toggles the popover and carries aria-expanded. Escape closes it and returns focus to the trigger; Tab moves through the content in document order (place a for popover straight after its trigger) and leaving it closes the popover. It is non-modal: focus stays on the trigger unless something inside has autofocus. Give it a label to expose the panel as a named, non-modal dialog. It fades over --mm-dur-menu, and appears instantly when opened from the keyboard. Pattern: https://www.w3.org/WAI/ARIA/apg/patterns/disclosure/

Properties​

PropertyAttributeTypeDefaultDescription
htmlForforstring''The id of the trigger, in the same document or shadow root.
anchorHTMLElement | nullnullThe trigger element, when it cannot be referenced by id.
placementplacementPlacement'bottom-start'Floating UI placement against the trigger.
offsetoffsetnumber4Gap between the trigger and the panel, in pixels.
matchWidthmatch-widthbooleanfalseMakes the panel at least as wide as the trigger.
openopenbooleanfalseOpens and closes the popover. Reflects.
labellabelstring''Names the panel, which is then exposed as a non-modal dialog.
triggerHTMLElement | nullThe element that toggles the popover.

Events​

EventDetailDescription
mm-toggleCustomEvent<PopoverToggleDetail>The popover opened or closed.

Slots​

SlotDescription
DefaultThe content.
triggerThe element that toggles the popover.

CSS parts​

PartDescription
panelThe floating panel.

CSS custom properties​

PropertyDescription
--mm-popover-paddingPanel padding. Defaults to --space-4.
--mm-popover-min-widthMinimum width. Defaults to 200px.
--mm-popover-max-widthMaximum width. Defaults to 360px.

Examples​

Every state of mm-popover in Storybook, with keyboard and screen reader tests.