Raft 设计系统

模式

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

The actionUse
People must finish something before they go on: a few fields, a choiceDialog
A confirmationA Dialog at size="sm", its confirm button colored by the consequence: retracting an assistant's message asks with Cancel and a red Retract message (Identity and presence). AlertDialog only where the product lists it (Raft Chat)
A next step for something people read before they act, inside a dialog or a formBanner
A change in one row of a list that waits for people to pick one of one or two answersA sm Banner directly under the row (Banner)
A shortcut after something the person just did: View, UndoToast
  • 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

SurfaceCloses byOwned by
DialogCancel, the × in its header or Esc; a small dialog (sm, md, lg) also on a click on the scrim. A sheet on a phone has no Cancel and closes by × or EscBehavior, On a phone
AlertDialogCancel, Esc, and its × (AlertDialogClose) when it has oneAnatomy, Behavior
BannerDismiss before its button, or a × (BannerClose) when it has no buttonAnatomy
ToastBy itself after a few seconds; people can also swipe it away or press EscBehavior

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.