Alert
Native controls work. Demo links and submissions stay inside this specimen. This example scrolls horizontally at this width.
Source markup
<!-- @dsCard group="Display" height=452 -->
<!DOCTYPE html>
<html lang="en-GB">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Alert</title>
<style>
/* Demo layout only. Every colour, radius and border comes from bundle.css. */
.demo {
display: grid;
grid-template-columns: 1fr 1fr;
gap: var(--space-md);
align-items: start;
max-width: 960px;
padding: var(--space-sm);
}
.demo__col { display: flex; flex-direction: column; gap: var(--space-2xs); }
.demo__stack { display: flex; flex-direction: column; gap: var(--space-2xs); }
/* The tone word sits in the .alert flex slot: hold it on one line and on the
first baseline of the sentence beside it. */
.demo .alert { align-items: baseline; }
.demo .alert > b { flex: none; }
/* Both panels carry their own margin-top in bundle.css; the columns space them here. */
.demo .nz-honest,
.demo .email-pgp { margin-top: 0; }
.demo .email-pgp p + p { margin-top: var(--space-2xs); }
/* A later caption belongs to the group under it, not the panel above it. */
.demo__col > .t-label:not(:first-child) { margin-top: var(--space-2xs); }
@media (max-width: 720px) { .demo { grid-template-columns: 1fr; } }
</style>
</head>
<body>
<div class="demo">
<section class="demo__col">
<p class="t-label">Four tones</p>
<div class="demo__stack">
<div class="alert alert--success" role="status">
<b class="label">Success</b>
<p class="base">Backup verified. Restore test passed.</p>
</div>
<div class="alert alert--warning" role="status">
<b class="label">Warning</b>
<p class="base">This domain expires in 21 days.</p>
</div>
<div class="alert alert--error" role="alert">
<b class="label">Error</b>
<p class="base">Payment failed. The invoice stays open.</p>
</div>
<div class="alert alert--info" role="status">
<b class="label">Info</b>
<p class="base">Noiz does not store your IP address when you join the mailing list.</p>
</div>
</div>
</section>
<section class="demo__col">
<p class="t-label">Honesty callout</p>
<aside class="nz-honest">
<div class="nz-honest__tag">Honest note</div>
<p class="base">Shared hosting is the cheapest place to start and the first thing a growing site outgrows. <b>Noiz says so</b> rather than sell another year of it.</p>
</aside>
<p class="t-label">Email PGP block</p>
<div class="email-pgp">
<p class="email-base"><b>PGP.</b> Mail to Noiz can be encrypted. The public key and its fingerprint are on noiz.ie.</p>
<p class="email-sm">Check it on a second channel before the first encrypted message.</p>
</div>
</section>
</div>
</body>
</html>
A short notice in a page or an email, keyed by a heavier left border in the tone colour and a leading word naming the tone.
Use it for a state the reader has to act on: a renewal date, a failed payment, a restore that finished. Not for marketing copy, for an explanation that belongs in body text, or as a toast. Nothing animates and nothing dismisses.
The consumer provides the markup and the copy. .alert is a flex row with space-sm between its children: tone word first, sentence second. Add one tone class. There is no icon slot and no close button. .alert never reads --division-accent, so a pillar scope changes nothing.
Colour never carries the meaning on its own: write Success, Warning, Error or Info as the first child.
Each tone class sets only the left border: .alert--success to color-semantic-status-success, .alert--warning to color-semantic-status-warning (yellow, never amber and never orange), .alert--error to color-semantic-status-error, .alert--info to color-semantic-status-info. All four share color-semantic-bg-surface, a color-semantic-border-base hairline, color-semantic-text-secondary text and radius-sm.
Accessibility
Section titled “Accessibility”- Role:
.alertis a plaindiv. The error tone takesrole="alert", the other three takerole="status". Both implyaria-live, so noaria-liveattribute is needed. - Accessible name: none. The tone word is the first child and is read with the sentence, which is why colour is never the only cue.
- Keyboard: not interactive. Nothing takes focus and nothing dismisses, so Tab, Enter, Space, Escape and the arrows do nothing.
- Target size: no interactive part, so WCAG 2.2 SC 2.5.8 does not apply.
.alertsets only padding ofspace-smbyspace-md; a link a consumer adds to the copy has to reach 24px itself. - Announcement:
role="status"announces politely androle="alert"interrupts. Neither announces markup already present at load, so insert the box when the state changes.
Two relatives sit in the same family. .nz-honest is the honesty callout, a space-lg panel keyed color-semantic-status-info at radius-md; give its .nz-honest__tag a div and not a p, since .nz-honest p is the more specific selector and would mute it. .email-pgp is the email footnote block, keyed color-semantic-accent-primary.
Do not tint the whole box in the tone colour, and do not set color-semantic-text-faint on alert copy: it fails AA at body size. The phosphor belongs to the accent, not to a status.
Hand-written from themes/noiz/assets/css/components.css (.alert and its four tones, .nz-honest, .nz-honest__tag, .email-pgp).