Navigation and overlays
Tabs
Tabs in line, boxed, pills and lifted styles. Built from radio inputs with panels in .tab-content, so arrow keys switch tabs without JavaScript, or from links for routed pages.
Example
<div class="tabs tabs-line" role="tablist"><input type="radio" name="project-tabs" class="tab" aria-label="Overview" checked><div class="tab-content" role="tabpanel">Traffic is up 12 percent this week.</div><input type="radio" name="project-tabs" class="tab" aria-label="Deployments"><div class="tab-content" role="tabpanel">Last deployment finished 4 minutes ago.</div><input type="radio" name="project-tabs" class="tab" aria-label="Settings"><div class="tab-content" role="tabpanel">Domains, environment variables and team access.</div></div><nav class="tabs tabs-boxed mt-6 w-fit" aria-label="Range"><a href="#" class="tab tab-active" aria-current="page">Day</a><a href="#" class="tab">Week</a><a href="#" class="tab">Month</a><a href="#" class="tab tab-disabled">Year</a></nav>Classes
15 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 tabs. On a <div> in the example. Sets flex display and alignment, and 5 custom properties.CSS |
|
| Modifier | Modifier, combined with the tabs class. On an <input> in the example. Sets inline-flex display, alignment, gap, height, padding and text size.CSS |
|
| Modifier | Modifier, combined with the tabs class. On an <a> in the example. Sets text color, shadow, background and border.CSS |
|
| Part | Part of the tabs. On a <div> in the example. Sets hidden by default, width and padding.CSS |
|
| Modifier | Modifier, combined with the tabs class. On an <a> in the example. Sets opacity and not-allowed cursor.CSS |
|
| Modifier | Modifier, combined with the tabs class. On a <div> in the example. Sets corner radius, shadow and border.CSS |
|
| Modifier | Modifier, combined with the tabs class. On a <nav> in the example. Sets gap, padding, generated content, absolute position, offsets and stacking order.CSS |
|
| Modifier | Modifier, combined with the tabs class. Not used in the example above. Sets gap, corner radius, background and text color.CSS |
|
| Modifier | Modifier, combined with the tabs class. Not used in the example above. Sets stacking order, border, corner radius, background, shadow and padding.CSS |
|
| Size | Extra small size. Not used in the example above. Sets --tab-h, --tab-px and --tab-fs.CSS |
|
| Size | Small size. Not used in the example above. Sets --tab-h, --tab-px and --tab-fs.CSS |
|
| Size | Medium, the default size. Not used in the example above. Sets --tab-h, --tab-px and --tab-fs.CSS |
|
| Size | Large size. Not used in the example above. Sets --tab-h, --tab-px and --tab-fs.CSS |
|
| Size | Extra large size. Not used in the example above. Sets --tab-h, --tab-px and --tab-fs.CSS |
|
| Modifier | Modifier, combined with the tabs class. Not used in the example above. Sets alignment.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">
<!-- Tabs: start from the base class, then add modifiers -->
<div class="tabs tabs-line" role="tablist"><input type="radio" name="project-tabs" class="tab" aria-label="Overview" checked><div class="tab-content" role="tabpanel">Traffic is up 12 percent this week.</div><input type="radio" name="project-tabs" class="tab" aria-label="Deployments"><div class="tab-content" role="tabpanel">Last deployment finished 4 minutes ago.</div><input type="radio" name="project-tabs" class="tab" aria-label="Settings"><div class="tab-content" role="tabpanel">Domains, environment variables and team access.</div></div><nav class="tabs tabs-boxed mt-6 w-fit" aria-label="Range"><a href="#" class="tab tab-active" aria-current="page">Day</a><a href="#" class="tab">Week</a><a href="#" class="tab">Month</a><a href="#" class="tab tab-disabled">Year</a></nav>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
- Give every control a visible
labellinked withfor, or anaria-labelwhen the purpose is obvious from context. Link help and error text witharia-describedby; invalid styles use:user-invalid, so they appear only after the user interacts. - Checkboxes and radios stay real inputs, so they keep native keyboard behavior (Space toggles, arrow keys move within a radio group) and form submission.
- Tabs follow the tabs pattern:
role="tablist",role="tab"witharia-selected, androle="tabpanel". - 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.