Brand Guide

Components

Dialog

A panel over the page for a short task or a piece of detail, which dims what is behind it.

Default

With a form

The form wraps the header, fields and footer, so Enter in a field saves. Saving closes the dialog.

Without the close button

showCloseButton={false} takes the cross out of the corner, for a dialog whose footer already has the one way out.

Controlled

A dialog with no trigger of its own opens from open.

Page dialog

A page laid over the current one, not a card: nearly the full screen, with no shadow or zoom, and a body that scrolls.

Best practices

  • Every dialog has a DialogTitle. It is what a screen reader announces when the dialog opens. Add a DialogDescription when one line under the title helps.
  • A dialog closes on Escape, on a press outside it and from the close button in its corner. If closing would lose something, ask first with an alert dialog.
  • Close from inside with DialogClose, drawn as a button with render. A form that saves closes the dialog itself once the save has worked, by holding open in state.
  • In the footer the main action is last. On a phone the buttons stack with the main action on top.
  • Use the page dialog for a whole screen of content, such as settings, that should return the person to exactly where they were when it closes. It has a title and a close button built in.
  • Dialogs sit at z-[80], so one opened from the full-screen chat on a phone shows above it.