Actions and feedback
Banner
A full width announcement bar for the top of the page, solid, soft or gradient.
Example
Classes
13 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 banner. On a <div> in the example. Sets hidden by default, flex display, alignment, gap, width and height, and 8 custom properties.CSS |
|
| Part | Part of the banner. On an <a> in the example. Sets inline-flex display, alignment, gap, text color, font weight and text style.CSS |
|
| Modifier | Modifier, combined with the banner class. On a <div> in the example. Sets border, and --banner-bg, --banner-fg and --banner-link.CSS |
|
| Modifier | Modifier, combined with the banner class. On a <div> in the example. Sets background.CSS |
|
| Modifier | Modifier, combined with the banner class. Not used in the example above. Sets sticky position, offsets and stacking order.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. Not used in the example above. Sets --tone and --tone-fg.CSS |
|
| Tone | Warning tone. On a <div> in the example. Sets --tone and --tone-fg.CSS |
|
| Tone | Danger tone. Not used in the example above. Sets --tone and --tone-fg.CSS |
|
| Tone | Info tone. Not used in the example above. Sets --tone and --tone-fg.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">
<!-- Banner: start from the base class, then add modifiers -->
<div class="space-y-3">
<div class="banner">
<span>Monsoon 1.0 is out with a new component layer.</span>
<a class="banner-link" href="#">Read the post <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M5 12h14M13 6l6 6-6 6"/></svg></a>
<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="banner banner-gradient"><span>Spring sale: 30% off all plans this week.</span><a class="banner-link" href="#">See pricing</a></div>
<div class="banner banner-soft banner-warning"><span>Scheduled maintenance on Sunday from 02:00 to 03:00 UTC.</span><a class="banner-link" href="#">Details</a></div>
</div>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. - 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.