Navigation and overlays
Mega menu
A wide navbar panel on <details name> so only one is open at a time, with sections, icon items with descriptions and a featured card.
Example
Classes
9 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 mega menu. On a <details> in the example. Sets pointer cursor, hidden by default, inline-flex display, alignment, gap and height.CSS |
|
| Part | Part of the mega menu. On a <div> in the example. Sets absolute position, offsets, stacking order, grid display, grid tracks and gap.CSS |
|
| Part | Part of the mega menu. On a <div> in the example. Sets flex display, alignment and gap.CSS |
|
| Part | Part of the mega menu. On a <p> in the example. Sets padding, text size, font weight and text color.CSS |
|
| Part | Part of the mega menu. On an <a> in the example. Sets flex display, alignment, gap, padding, corner radius and border.CSS |
|
| Part | Part of the mega menu. On a <span> in the example. Sets grid display, alignment, width, height, corner radius and text color.CSS |
|
| Part | Part of the mega menu. On a <span> in the example. Sets block display, text size, font weight, text style and text color.CSS |
|
| Part | Part of the mega menu. On a <span> in the example. Sets block display, margin, text size, text style and text color.CSS |
|
| Part | Part of the mega menu. On an <a> in the example. Sets flex display, alignment, gap, height, padding and corner radius.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">
<!-- Mega menu: start from the base class, then add modifiers -->
<header class="navbar"><div class="navbar-start"><a href="#" class="navbar-brand"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M4 15a8 8 0 0 1 16 0"/><path d="M12 15v5a2 2 0 0 1-4 0"/><path d="M12 7V4"/></svg>Acme</a></div><nav class="navbar-center" aria-label="Main"><details class="mega-menu" name="mega" open><summary>Product</summary><div class="mega-menu-panel"><div class="mega-menu-section"><p class="mega-menu-heading">Platform</p><a href="#" class="mega-menu-item"><span class="mega-menu-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="M13 2 4 14h7l-1 8 9-12h-7z"/></svg></span><span><span class="mega-menu-title">Edge functions</span><span class="mega-menu-description">Run code close to every user.</span></span></a><a href="#" class="mega-menu-item"><span class="mega-menu-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="m12 3 9 5-9 5-9-5z"/><path d="m3 13 9 5 9-5"/></svg></span><span><span class="mega-menu-title">Storage</span><span class="mega-menu-description">Files and blobs with global caching.</span></span></a></div><div class="mega-menu-section"><p class="mega-menu-heading">Security</p><a href="#" class="mega-menu-item"><span class="mega-menu-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="M12 3 4 6v6c0 5 3.5 8 8 9 4.5-1 8-4 8-9V6z"/></svg></span><span><span class="mega-menu-title">Firewall</span><span class="mega-menu-description">Block bad traffic before it lands.</span></span></a><a href="#" class="mega-menu-item"><span class="mega-menu-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="M4 19.5A2.5 2.5 0 0 1 6.5 17H20V3H6.5A2.5 2.5 0 0 0 4 5.5z"/><path d="M4 19.5V21h16"/></svg></span><span><span class="mega-menu-title">Audit logs</span><span class="mega-menu-description">Every change, searchable for a year.</span></span></a></div><a href="#" class="mega-menu-featured"><span class="mega-menu-title">New: Monsoon 2</span>Faster builds, smaller bundles and a fresh dashboard.</a></div></details><details class="mega-menu" name="mega"><summary>Resources</summary><div class="mega-menu-panel"><div class="mega-menu-section"><a href="#" class="mega-menu-item"><span class="mega-menu-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="M4 19.5A2.5 2.5 0 0 1 6.5 17H20V3H6.5A2.5 2.5 0 0 0 4 5.5z"/><path d="M4 19.5V21h16"/></svg></span><span><span class="mega-menu-title">Guides</span><span class="mega-menu-description">Step by step tutorials.</span></span></a></div></div></details></nav><div class="navbar-end"><a href="#" class="navbar-link">Sign in</a></div></header>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. - Wrap navigation in
navwith anaria-labelwhen there is more than one on the page, and mark the current link witharia-current="page". - 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.