Overlays

Dialogs, popovers, and menus, opened without JavaScript where the browser allows it.

Dialog

A modal dialog sits on the overlay surface over a blurred backdrop, and the page behind it doesn't scroll.

Dialog title

A modal dialog on the overlay surface with a blurred backdrop.

Accessibility

Open it with showModal(), which this demo does from the button, so focus moves into it and Escape closes it. Label it with aria-labelledby. closedby="any" also closes it on a click outside, where supported; leave it off a dialog that holds unsaved input.

Customize

It scales in, unless motion is reduced.

Popover

A popover opened by a popovertarget button, with no JavaScript.

A popover opened with popovertarget, no JavaScript needed.

Accessibility

Escape and a click outside close it, and the button tells screen readers whether it's open.

Customize

It slides up into place, unless motion is reduced.