Patterns
Actions and closing
Which surface carries an action, a dialog, a banner or a toast; how each one closes; and why a screen has at most one pink button. The specifics are in each component's doc.
The more a surface asks of people, the more deliberately it closes. A dialog asks for a decision and stays until people give one. A banner stays beside the work and offers a way forward, never the screen's main one. A toast is gone in seconds, so its one action is a shortcut or an Undo. This page says which one to reach for; each component's doc owns its parts, layout and rules.
When it applies
Every Dialog, AlertDialog, Banner and Toast that carries an action, in every Raft product. Which surface carries a message with no action, and where an error goes by its scope, is in Feedback; a Drawer, a PanelNotice (Panel) and the NotificationCenter follow their own docs.
Choosing the surface
- Whether an action is confirmed, offered with Undo or done at once is decided by how far it reaches (Feedback); the words on the buttons are in Writing.
- A toast's View is only a shortcut; its Undo is the way back (Toast).
How each one closes
A dialog has at most two buttons. The one exception is an unsaved-changes prompt that can save straight from the prompt (Dialog).
One pink button
Pink marks the one thing the screen exists for, so a screen has at most one pink button, and may have none (Button, Color).
- While a dialog is open it is the screen: its commit button is the one pink button, unless the consequence colors it orange or red (AlertDialog).
- A tour's coach mark is the one exception: its Next is pink while the page under it keeps its own pink button (the composer's send), because the tour lies over a live page instead of replacing it (Coach marks). It is planned with onboarding v3.
- A banner's button is never pink (Banner). A toast's action is a bold text action, not a button, so it is never pink either (Toast).
Not decided yet
The questions still open on these surfaces are in Open questions, each with the default to use until it is decided: a confirmation's ×, how long a dismissed new-version banner stays away, and the color and the component of an unsaved-changes prompt.
Related
- Feedback: which surface carries a message, and what is confirmed.
- Choosing a component: which overlay fits which job.
- Writing: the words on dialog buttons.
- Forms and settings: the buttons of a form in a dialog.