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.
Purpose
An anchored panel of any content: a notifications list, an account card, a small form. For a list of actions use a Menu, for a few words a Tooltip, and for a task that needs full attention a Dialog.
Behaviour
- By default it's modal: focus moves into the panel as it opens, stays inside, and returns to the trigger as it closes.
- With
modal={false}it's a non-modal dialog for a panel that works beside its anchor (an emoji panel beside a message field): focus isn't held inside, nothing in the page is hidden or made inert, and the panel follows its trigger in the Tab order: Tab from the trigger goes in and Tab from its last control on to what follows the trigger, and Shift + Tab retraces that way back. Arriving from anywhere else, it's passed over, so it's visited once each way. A press or focus in the anchor keeps it open, Escape in the anchor's text closes it, and a press or focus anywhere else closes it. The full-screen form below 600px is always modal. closedBysets what closes it:anyfor a press outside and Escape,closerequestfor Escape,nonefor neither.- It follows its anchor as the page scrolls and resizes.
triggerRefanchors it to another element, andplacementtakes Menu's values. - With
fullScreenOnCompact, below 600px wide it fills the window with a close button.
When not to use
For a list of actions use a Menu; for a few words, a Tooltip; for a task that needs full attention, a Dialog.
See also
- Menu: A temporary list of choices anchored to a trigger, with groups, selection, submenus and context menus, or a bottom sheet on phones.
- Tooltip: A plain label on hover or focus, or a rich tooltip with a subhead and an action.
- Dialog: A modal surface for a focused task or a decision, with a title, content and actions, or full screen on compact windows.