Cyber Week30% off Lifetime with code CYBER — it will never be this cheap againUntil 28 Nov, 10:00 CET

Interaction

Overlays

Pop-ups, modals, drawers and toasts built on the browser’s popover, with a script only for what the platform leaves out.

An overlay in sitereal is the browser's, not ours. popover on the panel, popovertarget on the button, :popover-open and ::backdrop in your own rule — the top layer, light dismiss, Escape and focus handling all come from the platform.

A placement, not a kind

PlacementForBy default
Centereda dialog — a newsletter, a confirmationblocks the page
Under its triggera popover hanging off the button that opened itno
A cornera toast, a small noticeno
A baracross the bottom, full width — a consent noticeno
A side drawera filter panel, a cartblocks the page

Blocks the page is a switch of its own, because that is what a modal actually is: while it is open the rest of the page is inert, focus moves in, and it goes back to the trigger when the panel closes. Placing a panel under its trigger uses CSS anchor positioning where the browser has it, and popup.js measures and places it where it does not.

The trigger is an element you pick

There is no hidden setting. Whatever carries popovertarget="<id>" is the trigger, which is exactly what the browser reads:

<button builder-data-element="button" popovertarget="menu-1">Account</button>

<div builder-data-element="div" id="menu-1" popover data-overlay="trigger">
  …
</div>

Any element can be a trigger — one that is not a button gets role="button" and tabindex="0" in the markup, since the browser reads popovertarget on buttons alone — and an overlay can have several. The Overlays fold of the Style panel asks it from both ends: on a panel, where it lands and how it opens; on anything else, which popup it opens.

Pop-ups: one panel, every page it belongs on

A popup is a thing the project owns rather than something built into a page: its own tree and stylesheet, edited on its own canvas with the panel held open, a rule for which pages it is on, and a rule for how it opens — click, hover, after a delay, at a scroll depth, on exit intent, or only from your own code. It can be shown once per session or for good, and only on desktop or only on mobile. A newsletter panel on nine pages is one panel appearing nine times.

What a panel looks like is the design system’s Popups module, at zero specificity, so a new popup’s own stylesheet starts empty and every rule in it is yours. Two details in that look are why a panel fades instead of blinking:

  • The closed state is display: none — the browser's own — so a transition has to opt in with allow-discrete.
  • @starting-style is the frame before it opens, so it has somewhere to come from.

A rule of yours on the panel — its id or a class — outranks both, and anything it does not mention keeps the default.

On the canvas

An overlay on the canvas is closed, as it is on the site, and opens while the selection is inside it — select it in the tree to work on it, or switch on Show it open in the Overlays fold to keep it open. A popup opened from Settings → Pop-ups is its own canvas, already open.

When not to use one

If the thing is a menu, build a navigation — dropdowns, mobile panel, focus trap and aria-* wiring are already done there. Overlays are for the rest: a modal, a filter panel, a video lightbox, a share sheet.