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

Alert

A message in the page: above a form, in a card, or across the top as a banner. It never takes focus, and never goes by itself.

Import
@qeetrix/react/experimental
Status
ExperimentalSince 0.0.4
Renders
<div>Server-rendered
Tested
WCAG 2.2 AAaxe on every pull request

01

When to use

Use it for
  • Why a form can't go on, above it.
  • A state of the page: a sync behind, a trial ending.
  • A notice about the whole app, as a banner.
Not for

02

Anatomy

  1. 1alert-icon<svg>The tone's icon, aria-hidden; the 3px edge beside it.
  2. 2alert-title<div>What happened, led by a hidden word: "Error:".
  3. 3alert-description<div>Why, and what to do.
  4. 4alert-actions<div>One primary action at most.
  5. 5dismiss<button>With onDismiss: "Dismiss".

03

Do and don't

Say what to do
DoWhat happened, and what to do about it.
Don'tAn error with nowhere to go.
The tone that's meant
DoWarning for a risk; danger only for what failed.
Don'tDanger for a notice: the page shouts.

04

Content

  • Titles say what happened, in a few words: "Directory sync failed".
  • The description says why, and what to do, in a sentence or two.
  • No exclamation marks; no Error or Warning in the title: the hidden word says it.
Next — AlertAPI