Navigation and overlays
Popover
A floating card on the native popover attribute: light dismiss, Escape and focus return for free. Anchored to its button where anchor positioning is supported, centered otherwise.
Example
<button type="button" popovertarget="plan-info" class="inline-flex items-center justify-center gap-2 rounded-lg border border-border bg-surface px-4 py-2 text-sm font-medium hover:bg-muted">What is included?</button><div id="plan-info" popover class="popover"><strong class="popover-title">Pro plan</strong><p class="text-muted-foreground">Unlimited projects, preview deployments and 30 days of analytics history.</p></div>Classes
6 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 popover. On a <div> in the example. Sets width, padding, text size, text style, background and text color.CSS |
|
| Part | Part of the popover. On a <strong> in the example. Sets block display, margin and font weight.CSS |
|
| Modifier | Modifier, combined with the popover class. Not used in the example above. Sets 4 custom properties.CSS |
|
| Modifier | Modifier, combined with the popover class. Not used in the example above. Sets 4 custom properties.CSS |
|
| Modifier | Modifier, combined with the popover class. Not used in the example above. Sets 4 custom properties.CSS |
|
| Modifier | Modifier, combined with the popover class. Not used in the example above. Sets --popover-area and --dropdown-pos.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">
<!-- Popover: start from the base class, then add modifiers -->
<button type="button" popovertarget="plan-info" class="inline-flex items-center justify-center gap-2 rounded-lg border border-border bg-surface px-4 py-2 text-sm font-medium hover:bg-muted">What is included?</button><div id="plan-info" popover class="popover"><strong class="popover-title">Pro plan</strong><p class="text-muted-foreground">Unlimited projects, preview deployments and 30 days of analytics history.</p></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
- Uses the
popoverattribute: the browser handles light dismiss, Escape and top layer stacking, andpopovertargetwires the trigger without JavaScript. - 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.