Actions and feedback
Alert
Inline messages in soft, outline and solid styles with an icon, title, description, actions and a script free dismiss.
Example
<div class="space-y-3">
<div class="alert alert-info" role="status">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>
<div class="alert-content">
<p class="alert-title">Update available</p>
<p class="alert-description">Version 2.4 adds offline sync and faster search.</p>
</div>
<div class="alert-actions"><button class="btn btn-sm btn-info">Update</button></div>
</div>
<div class="alert alert-success alert-outline" role="status">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="m8.5 12 2.5 2.5 4.5-5"/></svg>
<div class="alert-content"><p class="alert-title">Payment received</p><p class="alert-description">Invoice 1042 was paid in full.</p></div>
<details class="dismiss" open><summary aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg></summary></details>
</div>
<div class="alert alert-warning" role="alert">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M10.3 3.9 1.8 18a2 2 0 0 0 1.7 3h17a2 2 0 0 0 1.7-3L13.7 3.9a2 2 0 0 0-3.4 0z"/><path d="M12 9v4M12 17h.01"/></svg>
<div class="alert-content"><p class="alert-title">Your trial ends in 3 days</p></div>
<details class="dismiss" open><summary aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg></summary></details>
</div>
<div class="alert alert-danger alert-solid" role="alert">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 8v4M12 16h.01"/></svg>
<div class="alert-content"><p class="alert-title">Deployment failed</p><p class="alert-description">The build step exited with code 1.</p></div>
<details class="dismiss" open><summary aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg></summary></details>
</div>
<div class="alert">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M6 8a6 6 0 0 1 12 0c0 7 3 9 3 9H3s3-2 3-9"/><path d="M10.3 21a1.9 1.9 0 0 0 3.4 0"/></svg>
<div class="alert-content">A neutral alert with only a description.</div>
</div>
<div class="dismissible flex items-center justify-between gap-2 rounded-lg border p-3 text-sm">Any element can be dismissed. <details class="dismiss" open><summary aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg></summary></details></div>
</div>Classes
19 classes. Click a name to copy it. Utilities on the same element always win over component defaults, so any of them can be adjusted with plain utility classes.
| Class | Type | What it does |
|---|---|---|
| Base | Base class of the alert. On a <div> in the example. Sets hidden by default, flex display, alignment, gap, width and padding, and 9 custom properties.CSS |
|
| Part | Part of the alert. On a <svg> in the example. Sets alignment, width, height, margin and text color.CSS |
|
| Part | Part of the alert. On a <div> in the example. Sets alignment and width.CSS |
|
| Part | Part of the alert. On a <p> in the example. Sets text color, font weight, text style and margin.CSS |
|
| Part | Part of the alert. On a <p> in the example. Sets text color.CSS |
|
| Part | Part of the alert. On a <div> in the example. Sets flex display, alignment, gap and margin.CSS |
|
| Tone | Primary tone. Not used in the example above. Sets --tone and --tone-fg.CSS |
|
| Tone | Secondary tone. Not used in the example above. Sets --tone, --tone-fg and --tone-tint.CSS |
|
| Tone | Accent tone. Not used in the example above. Sets --tone and --tone-fg.CSS |
|
| Tone | Neutral tone. Not used in the example above. Sets --tone and --tone-fg.CSS |
|
| Tone | Success tone. On a <div> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Warning tone. On a <div> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Danger tone. On a <div> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Info tone. On a <div> in the example. Sets --tone and --tone-fg.CSS |
|
| Modifier | Modifier, combined with the alert class. Not used in the example above. Sets 4 custom properties.CSS |
|
| Modifier | Modifier, combined with the alert class. On a <div> in the example. Sets 4 custom properties.CSS |
|
| Modifier | Modifier, combined with the alert class. On a <div> in the example. Sets 4 custom properties.CSS |
|
| Part | Part of the alert. On a <details> in the example. Sets alignment, grid display, width, height, corner radius and text color.CSS |
|
| Part | Part of the alert. On a <div> in the example. A hook for state rules such as :is(.dismissible.CSS |
Usage
Components ship inside the same stylesheet as the utilities. There is nothing else to install and no script to load: link Monsoon and write the markup.
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">
<!-- Alert: start from the base class, then add modifiers -->
<div class="space-y-3">
<div class="alert alert-info" role="status">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="M12 16v-4M12 8h.01"/></svg>
<div class="alert-content">
<p class="alert-title">Update available</p>
<p class="alert-description">Version 2.4 adds offline sync and faster search.</p>
</div>
<div class="alert-actions"><button class="btn btn-sm btn-info">Update</button></div>
</div>
<div class="alert alert-success alert-outline" role="status">
<svg class="alert-icon" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="10"/><path d="m8.5 12 2.5 2.5 4.5-5"/></svg>
<div class="alert-content"><p class="alert-title">Payment received</p><p class="alert-description">Invoice 1042 was paid in full.</p></div>
<details class="dismiss" open><summary aria-label="Dismiss"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M18 6 6 18M6 6l12 12"/></svg></summary></details>
</div>
<!-- the full example is in the Code tab above -->Theme it with --seed on any ancestor, for example style="--seed: #0d9488", and force a scheme with class="dark" or class="light" on a wrapper.
Accessibility
- Built on
detailsandsummary, so it opens with Enter or Space and screen readers announce expanded and collapsed. A sharednamemakes a group exclusive. - Use
buttonfor actions andafor navigation. Icon only buttons need anaria-label; decorative icons carryaria-hidden="true". - Announces itself with
role="status"(polite) orrole="alert"(assertive). Use alert only for messages that need immediate attention. - Every interactive part shows a visible focus ring with
:focus-visible, and tone colors pair with-foregroundtokens that keep text at 4.5:1 or better in light and dark mode.