Alert
An inline, persistent message. Pair a title with a short description; the variant carries the tone.
Purpose
An alert stays until the situation changes, which is what separates it from a Toast. Put it next to the thing it is about.
Tones
Five variants; the tone carries severity, the glyph and text carry meaning.
Heads up
Claim submitted
Approaching your limit
You have used 80% of your outpatient entitlement this year.
Payment failed
We could not process your last payment. Please update your details.
Scheduled maintenance
The portal will be unavailable on Sunday between 02:00 and 04:00.
Icon
Each variant brings its own status glyph — info, check_circle, warning, error —
via withIcon, which defaults to true. Pass withIcon={false} for a text-only alert,
but only where the title already carries the severity.
Warning: approaching your limit
You have used 80% of your outpatient entitlement this year.
Structure
| Property | Value |
|---|---|
| Padding | 16px (p-4) |
| Layout | flex row, 12px gap (gap-3) |
| Radius | --radius-lg (8px) |
| Border | 1px tone colour at 20–40% opacity (--border for neutral) |
| Fill | tone subtle background with tone ink (bg-info-subtle / text-info-text …) |
| Icon | 20px tone glyph, nudged 2px down to align with the title |
| Title | <h5>, semibold, tight leading |
| Description | 14px (text-sm), relaxed leading |
Best practices
Do
- Place the alert next to the thing it describes — a form, a record, a section.
- Pick the tone by severity, not decoration:
destructivemeans something failed or is at risk. - Keep the title to one line and the description to a sentence or two.
- Override
roleto"status"for polite confirmations injected after load (see below).
Don't
- Use an alert for transient confirmations — that is a Toast's job.
- Stack several alerts in one place; merge them or fix the worst problem first.
- Remove the icon and rely on colour alone to signal severity.
- Put the primary action of the page inside an alert — link out to where the fix happens.
Accessibility & keyboard
The component renders role="alert" by default — an assertive live region. Because
your props spread after the default, you can override it, and the right role depends on
when the alert appears:
- Injected after load, demands attention — keep the default
role="alert": screen readers interrupt to announce it. Right for failures and anything blocking the user. - Injected after load, polite confirmation — pass
role="status": announced at the next pause instead of interrupting. Right forsuccessandinfomessages. - Present at page load — no live region fires: announcements only happen when content is inserted into an existing region, so static alerts are simply read in document order. Nothing extra needed.
Also:
AlertTitlerenders an<h5>— keep it short; it is what scanning users and heading navigation land on.- Severity is never colour-only: each tone pairs a glyph and written text.
- Keyboard: an alert is not focusable and receives no focus when it appears — any link inside it sits in the normal Tab order.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
withIcon | boolean | undefined | true | Show the leading status glyph. |
variant | "info" | "success" | "warning" | "destructive" | "neutral" | null | undefined | — | — |