Monsoon v0.2.0
Made by Alexandre Kohler Star

Navigation and overlays

Responsive drawer

An app shell whose drawer is a toggled overlay on small screens and a sticky, always open sidebar from the lg breakpoint.

Navigation and overlays1 classesNo JavaScriptLight and dark

Example

Full

Classes

1 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.

ClassTypeWhat it does
Base Base class of the responsive drawer. On a <div> in the example. Sets grid tracks, sticky position, offsets, stacking order, height and overflow.
CSS
@media (min-width: 1024px) {
  .drawer-open-lg > .drawer-content {
    grid-column: 2;
  }
}

@media (min-width: 1024px) {
  .drawer-open-lg.drawer-end > .drawer-side {
    grid-column: 2;
  }
}

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.

index.html
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/monsooncss">

<!-- Responsive drawer: start from the base class, then add modifiers -->
<div class="drawer drawer-open-lg"><input id="app-drawer" type="checkbox" class="drawer-toggle"><main class="drawer-content p-6"><label for="app-drawer" 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 cursor-pointer lg:hidden">Menu</label><h1 class="mt-4 text-2xl font-semibold">Overview</h1></main><div class="drawer-side"><label for="app-drawer" class="drawer-overlay" aria-label="Close menu"></label><nav class="drawer-panel" aria-label="App"><ul class="menu"><li><a href="#" aria-current="page"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 10.5 12 3l9 7.5V20a1 1 0 0 1-1 1h-5v-6H9v6H4a1 1 0 0 1-1-1z"/></svg>Overview</a></li><li><a href="#"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M3 3v18h18"/><path d="m7 15 4-4 3 3 5-6"/></svg>Reports</a></li><li><a href="#"><svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="3"/><path d="M12 2v3M12 19v3M4.9 4.9 7 7M17 17l2.1 2.1M2 12h3M19 12h3M4.9 19.1 7 17M17 7l2.1-2.1"/></svg>Settings</a></li></ul></nav></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

  • Give every control a visible label linked with for, or an aria-label when the purpose is obvious from context. Link help and error text with aria-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.
  • Wrap navigation in nav with an aria-label when there is more than one on the page, and mark the current link with aria-current="page".
  • Every interactive part shows a visible focus ring with :focus-visible, and tone colors pair with -foreground tokens that keep text at 4.5:1 or better in light and dark mode.

No recent searches

Try , , or .

Recent

Loading the search index

No results for ""

Check the spelling, or search a class name such as px-4.