Fine-tune light, shadows, borders, neumorphic
Light and shadows
Borders
Neumorphic
Overlays

Popover <pm-popover>

Non-modal popover panel. Trigger with native popovertarget="id" on any button.

Full screen
Share this page

Anyone with the link can view it.

Hover card: @ada
Ada LovelaceDesign systems, London

Props

<script type="module"> import '@prismora/css'; import '@prismora/elements/avatar'; import '@prismora/elements/copy-button'; import '@prismora/elements/input'; import '@prismora/elements/popover'; </script> <button class="pm-button" data-variant="soft" popovertarget="demo-pop">Share</button> <pm-popover id="demo-pop" aria-label="Share"> <header> <strong>Share this page</strong> <p class="pm-muted pm-text-sm">Anyone with the link can view it.</p> </header> <div class="pm-popover-body"> <pm-input label="Link" value="https://prismora.design/s/42" readonly></pm-input> </div> <footer> <button class="pm-button" data-variant="ghost" data-tone="neutral" data-size="sm" popovertarget="demo-pop" popovertargetaction="hide">Close</button> <pm-copy-button value="https://prismora.design/s/42" size="sm" show-label></pm-copy-button> </footer> </pm-popover> <a id="demo-hc" href="/docs">Hover card: @ada</a> <pm-popover id="demo-hc-card" trigger="hover" for="demo-hc" aria-label="Ada Lovelace"> <div class="pm-cluster"> <pm-avatar name="Ada Lovelace"></pm-avatar> <div class="pm-stack" style="--pm-gap: 0"> <span class="pm-weight-semibold">Ada Lovelace</span> <span class="pm-text-xs pm-muted">Design systems, London</span> </div> </div> </pm-popover> <button class="pm-button" data-variant="outline" data-tone="neutral" popovertarget="demo-mega">Products (mega menu)</button> <pm-popover id="demo-mega" class="pm-mega" aria-label="Products"> <div class="pm-mega-group"> <p class="pm-mega-title">Build</p> <a href="/components"> Components <small>Buttons, forms, tables</small> </a> <a href="/examples"> Templates <small>Whole pages to copy</small> </a> </div> <div class="pm-mega-group"> <p class="pm-mega-title">Theme</p> <a href="/generator"> Generator <small>One colour to a full theme</small> </a> <a href="/docs/tokens"> Tokens <small>Every design decision as a variable</small> </a> </div> </pm-popover>

Overview

trigger="hover" turns it into a hover card: it opens when the element named by for is hovered or focused and stays open while the pointer is over the card, so its content can be read and clicked. Keep hover cards supplementary: touch users reach the same content by following the link. class="pm-mega" lays the panel out as a wide grid of link groups for a navigation (mega) menu.

Attributes

AttributeTypeDefaultDescription
trigger'click' | 'hover'—How it opens: by its popovertarget button (default), or on hover and focus of the for element.
forstring—id of the element that opens a hover card.
placement'bottom' | 'top' | 'start' | 'end'—Side of the trigger it opens on (default bottom); flips when there is no room. Regions are plain markup inside it: a <header> (a title and a line under it), a <div class="pm-popover-body"> and a <footer> for actions. With a body, the header and footer stay in place and the body scrolls when the popover is as tall as the screen (or as its own max-block-size).
popover'auto' | 'manual'—Light-dismiss behaviour (default auto).

Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.

Slots

SlotDescription
(default)Panel content: anything, or a <header>, a .pm-popover-body and a <footer>.