Components / Base / Dialog

B9 · Base

Dialog

A native modal dialog with a title, a short body, and a close button.

When to use

  • A step needs a decision before the page continues.
  • The content is short.

When not to use

  • The notice can sit inline. Use a toast.
  • The content is a full view. Use a page.

Usage

<button type="button" class="btn sm">Archive DOC-1042</button>
<dialog class="c-dialog">
  <h3>Archive this example record</h3>
  <button type="button">Close</button>
</dialog>

Variants

The preview shows the form used in the gallery.

Props

NameTypeDefaultDescription
dialogelement—Opened with showModal.
aria-labelledbyid—Points at the heading.
data-close-dialogbutton—Calls close.

Keyboard

KeyAction
EnterOn the opener, shows the dialog.
EscapeCloses the native dialog.
TabCycles inside the dialog while it is open.

Accessibility

Motion

Pattern origin

Base overlay. Native dialog, no shadow.

Related

Timed gateToastButton