Alert Box
Inline status message with a variant-mapped icon, optional title, and optional dismiss control.
Preview
Heads up
<AlertBox variant="info" title="Heads up">
This is an informational message.
</AlertBox> Variants
Heads up
Saved
Check this
Error
<AlertBox variant="info" title="Heads up">This is an informational message.</AlertBox>
<AlertBox variant="success" title="Saved">Your changes were saved successfully.</AlertBox>
<AlertBox variant="warning" title="Check this">Some fields need your attention.</AlertBox>
<AlertBox variant="danger" title="Error">Something went wrong while saving.</AlertBox> States
The title is optional — omit it for a compact single-line alert. With dismissable, a close button appears and a dismissed event bubbles on click.
Dismiss me
<AlertBox variant="info">A compact, single-line alert with just a message.</AlertBox>
<AlertBox variant="warning" title="Dismiss me" dismissable={true}>Click the × to hide this alert.</AlertBox> API
| Prop | Type | Default | Description |
|---|---|---|---|
variant | 'info' | 'success' | 'warning' | 'danger' | 'info' | Tone — drives the background, border, and auto-mapped icon. |
title | string | — | Optional bold heading above the message. |
dismissable | boolean | false | Shows a close button that hides the alert and emits a dismissed event. |
Events
| Event | Type | Default | Description |
|---|---|---|---|
dismissed | CustomEvent | — | Bubbles when the close button is clicked (dismissable only). |
Accessibility
- Icons are auto-mapped per variant (info / circle-check / triangle-alert / circle-alert) and marked
aria-hidden. - The dismiss button has an
aria-label="Dismiss". - For time-sensitive alerts, wrap in a live region (
role="alert"/aria-live) at the call site so screen readers announce it.
Theming surface
Every public token this component reads, extracted from its source at build time.
The Resolves to column walks each token's real lineage —
component → semantic → primitive → raw value — so you
can see exactly where re-pointing it lands. A spoke re-skins by overriding these in
its theme-<slug>.css; component internals are never edited. No
hook for what you need? File it with /request-lego.
| Token | Tier | Resolves to |
|---|---|---|
--alert-box-bg | component | #f4faff via --color-info-subtle → --color-status-info-subtle → --color-blue-2 |
--alert-box-border-color | component | #acd8fc via --color-info-border → --color-status-info-border → --color-blue-6 |
--alert-box-dismiss-bg-hover | component | rgba(0, 0, 0, 0.06) |
--alert-box-radius | component | 0.5rem via --radius-200 |
--alert-box-text-color | component | #646464 via --color-text-secondary → --color-gray-11 |
--alert-box-title-color | component | #202020 via --color-text-primary → --color-gray-12 |
--focus-ring-color | component | #65ba74 via --color-border-focus → --color-grass-8 |
--focus-ring-width | component | 2px |
--color-danger-border | semantic | #fdbdbe via --color-red-6 |
--color-danger-strong | semantic | #ce2c31 via --color-red-11 |
--color-danger-subtle | semantic | #fff7f7 via --color-red-2 |
--color-info-strong | semantic | #0d74ce via --color-status-info-strong → --color-blue-11 |
--color-success-border | semantic | #c2da91 via --color-status-success-border → --color-lime-6 |
--color-success-strong | semantic | #5c7c2f via --color-status-success-strong → --color-lime-11 |
--color-success-subtle | semantic | #f8faf3 via --color-status-success-subtle → --color-lime-2 |
--color-text-muted | semantic | #838383 via --color-gray-10 |
--color-text-primary | semantic | #202020 via --color-gray-12 |
--color-warning-border | semantic | #f3d673 via --color-status-warning-border → --color-yellow-6 |
--color-warning-strong | semantic | #ab6400 via --color-status-warning-strong → --color-yellow-11 |
--color-warning-subtle | semantic | #fefbe9 via --color-status-warning-subtle → --color-yellow-2 |
--focus-ring-offset | semantic | 2px |
--transition-fast | semantic | 150ms ease |
--type-size-150 | semantic | clamp(0.6875rem, 0.61rem + 0.38vw, 0.875rem) |
--radius-100 | primitive | 0.25rem |
--spacing-050 | primitive | 0.125rem |
--spacing-300 | primitive | 0.75rem |
--spacing-400 | primitive | 1rem |