Actions and feedback
Toast
A fixed stack for toast messages in six positions, with a contained variant for previews.
Example
<div class="relative h-64 rounded-xl border bg-muted overflow-hidden">
<div class="toast toast-contained toast-top toast-center">
<div class="alert alert-success alert-solid" 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">Changes saved</div></div>
</div>
<div class="toast toast-contained toast-bottom toast-end">
<div class="toast-item" role="status">
<svg class="size-5 shrink-0 text-primary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 6L2 7"/></svg>
<div class="flex-1">
<p class="toast-title">Message sent</p>
<p class="toast-description">Your invite is on its way to the team.</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>
</div>Classes
10 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 toast. On a <div> in the example. Sets fixed position, stacking order, offsets, flex display, alignment and gap.CSS |
|
| Modifier | Modifier, combined with the toast class. On a <div> in the example. Sets offsets.CSS |
|
| Modifier | Modifier, combined with the toast class. On a <div> in the example. Sets offsets.CSS |
|
| Modifier | Modifier, combined with the toast class. Not used in the example above. Sets offsets.CSS |
|
| Modifier | Modifier, combined with the toast class. On a <div> in the example. Sets offsets and transform.CSS |
|
| Modifier | Modifier, combined with the toast class. On a <div> in the example. Sets offsets.CSS |
|
| Modifier | Modifier, combined with the toast class. On a <div> in the example. Sets absolute position and width.CSS |
|
| Part | Part of the toast. On a <div> in the example. Sets hidden by default, flex display, alignment, gap, width and padding, and 4 custom properties.CSS |
|
| Part | Part of the toast. On a <p> in the example. Sets font weight and margin.CSS |
|
| Part | Part of the toast. On a <p> in the example. Sets text color.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">
<!-- Toast: start from the base class, then add modifiers -->
<div class="relative h-64 rounded-xl border bg-muted overflow-hidden">
<div class="toast toast-contained toast-top toast-center">
<div class="alert alert-success alert-solid" 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">Changes saved</div></div>
</div>
<div class="toast toast-contained toast-bottom toast-end">
<div class="toast-item" role="status">
<svg class="size-5 shrink-0 text-primary" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="m22 7-10 6L2 7"/></svg>
<div class="flex-1">
<p class="toast-title">Message sent</p>
<p class="toast-description">Your invite is on its way to the team.</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>
<!-- 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. - 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.