Skip to main content
  1. Docs
  2. Components
  3. Overlays

Dialog

A focused decision or a short task, over the page. Danger and warning ask before something happens.

Import
@qeetrix/react
Status
StableSince 0.0.2
Renders
<div role="dialog">Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

When to use

Use it for
  • A decision that stops the page: revoke, delete, turn off.
  • A short task: edit a profile, invite a person.
  • Terms to read and accept.
Not for
  • A task beside the page, with the page in viewDrawer
  • A few options from a buttonMenu
  • Content anchored to its triggerPopover
  • Saying something happenedToast

02

Anatomy

  1. 1dialog-title<h2>The question or the task; it names the dialog.
  2. 2dialog-description<p>A line under it; it describes the dialog.
  3. 3dialog-body<div>The content; it scrolls when the dialog is at its tallest.
  4. 4dialog-footer<div>The actions, end-aligned: the least destructive first.
  5. 5dialog-close<div>Close: last in the focus order, so focus lands on the content first.

03

Do and don't

The title asks the question
DoWhat's about to happen, and what follows.
Don't"Are you sure?": sure of what?
Buttons say what they do
DoCancel, then the action in its own words.
Don'tOK and Cancel: which one revokes?

04

Content

  • The title is the question or the task: "Revoke this API key?", "Edit profile".
  • The description says what follows, plainly: "This can't be undone."
  • Buttons are verbs: "Revoke key", never "OK" or "Yes".
Next — DialogAPI