Skip to Content

Overlays

Where popovers, menus, dialogs, tooltips and toasts mount, and how they stack.

Where they mount

Popovers, menus, dialogs, tooltips and toasts mount inside the nearest element with a data-theme. They inherit its theme and --accent. With no such element they fall back to document.body, in a div.nc that copies the theme of the opener and keeps it in step.

The order

Overlays stack in a fixed order, lowest first:

  1. the phone drawer
  2. the scrim of a dialog
  3. popovers
  4. tooltips
  5. toasts

A Select, menu or tooltip opened in a Dialog shows above it. Escape closes only the topmost open layer.

Overlays stack in one orderdrawer < dialog scrim < popovers < tooltips < toasts. Open the dialog, then the Select inside it, hover the help button, and raise a toast: each shows above the one before. Escape closes only the topmost.
Open the example ↗

Popover

A Popover is a box that floats next to an anchor element. It flips to the other side when there is no room and stays inside the viewport. Escape or a press outside it closes it.

Anchored contentIt flips when there is no room, clamps to the viewport and closes on Escape or an outside press.
Open the example ↗

Dialog

A Dialog is centred, bare, near the top, or a bottom sheet. Focus moves in when it opens, Tab cycles inside, and Escape closes it. Focus then returns to the button that opened it.

Destructive confirmationThe dialog names what will be lost, and the button says exactly what happens. Focus moves in, Tab cycles inside, Escape closes and focus returns to the button.
Open the example ↗

Tooltips and toasts

A tooltip shows the label of an IconButton with its shortcut.

Toasts are short notices in a live region at the bottom right. Danger toasts are announced assertively, and hover pauses the timer. Put a ToastRegion next to the root of the app.

Tones
Open the example ↗
Edit on GitHub

Last updated on

On this page