Actions and feedback
Notification
A notification card with an icon or avatar, message, meta line, actions and an unread marker.
Example
<div class="space-y-3 max-w-md">
<div class="notification notification-unread">
<div class="notification-icon">AL</div>
<div class="notification-content">
<p class="notification-title">Ada Lovelace invited you to Analytics</p>
<p class="notification-body">Join the workspace to view shared dashboards.</p>
<div class="notification-actions">
<button class="btn btn-sm">Accept</button>
<button class="btn btn-sm btn-ghost btn-neutral">Decline</button>
</div>
<p class="notification-meta"><span>2 min ago</span><span class="status status-xs"></span><span>Workspace</span></p>
</div>
</div>
<div class="notification">
<div class="notification-icon"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4M7 10l5 5 5-5M12 15V3"/></svg></div>
<div class="notification-content">
<p class="notification-title">Export ready</p>
<p class="notification-body">report-september.csv is ready to download.</p>
<p class="notification-meta">1 hour ago</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>Classes
8 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 notification. On a <div> in the example. Sets hidden by default, flex display, alignment, gap, padding and border, and 4 custom properties.CSS |
|
| Part | Part of the notification. On a <div> in the example. Sets grid display, alignment, width, height, overflow and corner radius.CSS |
|
| Part | Part of the notification. On a <div> in the example. Sets alignment and width.CSS |
|
| Part | Part of the notification. On a <p> in the example. Sets text color, font weight and text style.CSS |
|
| Part | Part of the notification. On a <p> in the example. Sets margin, text color and text style.CSS |
|
| Part | Part of the notification. On a <p> in the example. Sets flex display, alignment, gap, margin, text color and text size.CSS |
|
| Part | Part of the notification. On a <div> in the example. Sets flex display, alignment, gap and margin.CSS |
|
| Modifier | Modifier, combined with the notification class. On a <div> in the example. Sets border, background, generated content, absolute position, offsets and width.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">
<!-- Notification: start from the base class, then add modifiers -->
<div class="space-y-3 max-w-md">
<div class="notification notification-unread">
<div class="notification-icon">AL</div>
<div class="notification-content">
<p class="notification-title">Ada Lovelace invited you to Analytics</p>
<p class="notification-body">Join the workspace to view shared dashboards.</p>
<div class="notification-actions">
<button class="btn btn-sm">Accept</button>
<button class="btn btn-sm btn-ghost btn-neutral">Decline</button>
</div>
<p class="notification-meta"><span>2 min ago</span><span class="status status-xs"></span><span>Workspace</span></p>
</div>
</div>
<div class="notification">
<!-- 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". - 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.