Appearance
Feedback
What people see after they act: that it is running, that it worked, or what went wrong.
components-notification--after-an-actionOpen in Storybook ↗When it applies
- After every action that changes data: saving a field, a form or a bulk edit, creating, deleting, importing, exporting.
- Before an action that loses data, as a question.
- While an action runs and the result is not there yet.
How it works
- Show it running where it was started. Otherwise people click again. A button that starts an action shows its loading state: a spinner and
aria-busy, and a second click is ignored until the action ends. An editor shows a spinner in place of its buttons while it saves. - Block only long operations, and say what is happening. A bulk edit, a merge, a CSV export or a guided flow puts a blocking overlay over the app, or over the open dialog only, with a one-line message. Shorter waits never block.
- Confirm a result at the place it happened, and in a notification. A saved field shows its check on the row and in the panel header for 2 seconds and announces Saved; see Per-field editing. Record-level results (created, updated, deleted, {n} entities were updated) show a notification.
- Keep errors next to their cause. An invalid value shows its message under the input, and a refused field save shows Saving failed, try again in the editor, which stays open with the value kept. Only errors without a place go to an error notification: a server error, or an action that failed as a whole (Something went wrong).
- Ask only before real loss. A question every time trains people to click OK. A confirm dialog comes before deleting a record, a comment or a saved search, removing a saved row, a bulk change, and leaving a form or the page-wide edit mode with unsaved changes. Editing a field never asks: leaving it saves. Logging out and creating an entity from a dropdown also ask today.
- Notifications tell, they do not ask. A notification has no buttons and nothing depends on reading it. Undo does not exist; an action that cannot be taken back asks first (rule 5).
Notifications
| Type | Look | Used for |
|---|---|---|
| Success | inverted surface | a result: saved, created, deleted, exported |
| Warning | inverted surface, --color-warning bar on the left | a partial result or a job still running: Saving failed for a form with errors, skipped items in a bulk edit |
| Error | inverted surface, --color-danger bar on the left | a failure without a place on screen |
components-notification--typesOpen in Storybook ↗- They stack in the top right, newest on top,
--shadow-toast,--radius-overlay, title in bold. - They disappear after 10 seconds. A click closes one sooner. Hovering does not pause them.
- A persistent notification stays until the work ends, such as a running job or an export that is being prepared, and is then replaced by its result.
- While a dialog is open, notifications show on top of it.
- Two special ones sit in their own group: a new app version (the whole notification is clickable and reloads the page), and an announcement a tenant configures, which stays until closed.
Components
| Component | Role in this pattern |
|---|---|
| Notification | success, warning and error messages (useBaseNotification) |
| Button | the loading state of the action that runs |
| Loading | the blocking overlay for long operations |
| Modal | the confirm dialog before real loss |
| Field row | the saved check and the Saved announcement |
| Inline editor | the saving spinner and the error message of a field |
Keyboard & accessibility
- A loading button is disabled and
aria-busy="true". - The blocking overlay is
role="alert"witharia-busy="true"; its message is what screen readers hear. - A field's error is
role="alert"; a field's save is announced through arole="status"region. - Notifications are not announced by screen readers and cannot be closed from the keyboard. Anything a person must know therefore also shows in place (rules 3 and 4).
- A confirm dialog puts focus on Cancel, so Enter never confirms a loss by accident.
Content
- A notification title says what happened, a short sentence in the past tense: Entity successfully created. The text adds the detail: {n} entities were updated.
- An error says what failed and, when possible, what to do: Saving failed, try again.
- A confirm dialog names the action on its button: Delete permanently, Remove, Leave editor. Never OK or Yes.
- Translation keys:
notifications.success.*,notifications.warning.*,notifications.errors.*,inline-edit.saved,inline-edit.save-failedandconfirm.*.
Related
Per-field editing · Action discovery · Loading · Modal · Button