Popover
ProAn anchored panel of any content, with managed focus and light dismiss, that fills the window on a phone. Not an M3 component (@windmorph/react-pro).
import { Popover, PopoverTrigger } from '@windmorph/react-pro';Part of Windmorph Pro, paid components on the free core, not on sale yet. See the Pro guide for what it includes and to register interest.
Props
Popover 23 props
The panel's content.
placementtype"top" | "bottom" | "start" | "end" | "top-start" | "top-end" | "bottom-start" | "bottom-end" | "start-top" | "start-bottom" | "end-top" | "end-bottom"default"bottom-start"Where the panel opens beside its anchor.
The gap between the anchor and the panel, px.
Shifts the panel along its anchor, px.
The element to anchor to, when the popover has no
PopoverTrigger.Whether it is open (controlled). Ignored inside a
PopoverTrigger, which owns it.Whether it starts open, when uncontrolled.
How a person may close it:
any(a press outside, or Escape),closerequest(Escape only) ornone(only the app).Fill the window below 600px wide, with a header holding a close button.
Whether the rest of the page waits while it's open: focus stays inside, the page is hidden from assistive technology and a press outside only closes it.
falsemakes it a non-modal dialog (WAI-ARIA), for a panel that works beside what it's anchored to (the emoji picker in a message field): the page stays usable and the anchor (triggerRef, else thePopoverTrigger's button) and the panel act as one. Focus or a press in the anchor keeps it open and Escape there closes it (unless a list it controls is open). The panel follows the trigger in Tab order: Tab goes from the trigger into the panel and from its last control to what follows the trigger, and Shift + Tab mirrors it, from what follows the trigger into the panel's last control and from its first back to the trigger. Since the panel is last in the page, Tab from the page's last control passes over it and leaves the page, and Shift + Tab coming back into the page goes to the page's last control outside it (into it only when nothing follows the trigger). Focus or a press anywhere else closes it. The full-screen form below 600px is always modal.Focus the panel's first control as it opens.
falsefocuses the panel itself, for content that decides its own first focus (a search box only with a fine pointer).The full-screen header's text.
Replaces the full-screen form's close icon.
Ref to the outermost element.
The outermost element's id.
Events
Called when it opens or closes.
Called when it has finished closing.
Text
Words it shows or announces. A
LabelsProvidersets them for the whole app.One of
aria-labeloraria-labelledbyis required.One of
aria-labeloraria-labelledbyis required.
Classes for the outermost element. Wins over the defaults via
cn().Classes for each part.
The box that reveals the panel as it opens.
The outermost element (the same element as
className).The surface.
The scrolling area around the children.
The full-screen form's header.
The full-screen form's close button.
Inline styles for the outermost element.
Also accepts the root element's HTML attributes (id, data-*, event handlers).
PopoverTrigger 4 props
The trigger (any button-like component) followed by the
Popover.Whether it is open (controlled).
Whether it starts open, when uncontrolled.
Spec status
Not part of Material Design 3: a Windmorph Pro component, built on M3's colour roles, type scale, shapes and motion. Its variants and configurations each link to a live example.
Theming & tokens
Set the tokens below on the panel or any ancestor, such as :root, since it renders in a portal. Style each part with classNames: root, panel, content, header, close.
| Variable | Default | Paints |
|---|---|---|
--wm-popover-container-color | var(--md-sys-color-surface-container) | The panel’s surface. |
--wm-popover-container-shape | var(--md-sys-shape-corner-large) | The panel’s corners. |
--wm-popover-container-elevation | var(--md-sys-elevation-level-2) | The panel’s shadow. |
--wm-popover-text-color | var(--md-sys-color-on-surface) | The content’s default text colour. |
--wm-popover-padding | 16px | The space around the content. |
--wm-popover-min-width | 112px | The least width of the panel. |
--wm-popover-max-width | min(480px, calc(100vw - 32px)) | The greatest width of the panel. |
--wm-popover-max-height | min(560px, calc(100dvh - 32px)) | The content’s greatest height, past which it scrolls. |
--wm-popover-reveal-duration | var(--md-sys-motion-spring-spatial-fast-duration) | How long the reveal from the anchored edge takes. |
--wm-popover-reveal-easing | var(--md-sys-motion-spring-spatial-fast-easing) | The easing of the reveal. |
--wm-popover-fade-duration | var(--md-sys-motion-spring-effects-fast-duration) | How long the fade takes; it stays under reduced motion. |
--wm-popover-fade-easing | var(--md-sys-motion-spring-effects-fast-easing) | The easing of the fade. |