Utility-first CSS in one stylesheet, with seed color theming and automatic dark mode.
Documentation · Components · Playground · Page builder · Português
Monsoon is a CSS file with every utility class and component already written. Link it, write classes such as px-4, md:grid-cols-3 or btn btn-primary in your HTML, and refresh. There is no compiler and no config file. One --seed color gives you a whole theme, and dark mode follows the system on its own.
Save this as index.html and open it in a browser:
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/[email protected]/dist/monsoon.min.css">
</head>
<body class="bg-background text-foreground antialiased">
<main class="mx-auto max-w-md p-8">
<div class="card">
<div class="card-body space-y-4">
<h1 class="text-2xl font-bold">Hello, Monsoon</h1>
<p class="text-muted-foreground">One stylesheet. No build step.</p>
<button class="btn btn-primary">Get started</button>
</div>
</div>
</main>
</body>
</html>Pin the version, as above, so the file never changes under you.
npm install monsooncssimport 'monsooncss';Without a bundler, copy node_modules/monsooncss/dist/monsoon.min.css into your public folder and link it from your layout. The install page lists the entry file for common frameworks.
:root { --seed: #0d9488; }Monsoon derives primary, secondary, accent, surfaces, borders, the focus ring and readable foreground colors from the seed with OKLCH relative colors, in the browser. Put style="--seed: teal" on any element to theme only that part of the page. The tests check 4.5:1 contrast for the token pairs across many seeds, in light and dark mode.
Dark mode follows prefers-color-scheme. Force a scheme with data-theme="dark", class="dark" or class="light" on the root or on any section; the nearest themed ancestor wins.
167 components, such as buttons, forms, cards, tables, dialogs, menus and navigation, are in the same stylesheet and are built on native HTML. A few behaviors that CSS cannot finish, for example a file drop zone or an image cropper, come from the optional script:
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/monsoon.js" defer></script>The script also adds arbitrary values such as w-[37px] or bg-[#0d9488]. Every component page on the site has a live preview and a Copy HTML button.
The full file is about 88 kB with brotli. To keep only the classes you use:
npx monsooncss purge "src/**/*.html" -o public/monsoon.cssUse --safelist a,b,c for class names built at runtime. Arbitrary value classes found in your files are compiled at the same time.
Current Chrome, Edge, Firefox and Safari. Seed theming needs relative color syntax (Chrome and Edge 119, Firefox 128, Safari 18). Older browsers get static tokens from the default seed.
- Stacked variants such as
dark:hover:on the prebuilt classes (arbitrary value classes can stack them). - The important modifier.
- Opacity modifiers on palette steps, such as
bg-emerald-500/50.
graphemely, edgegoat, vueleap, numberparrot, breakhound, Voodoo.js (used for the interactive parts of the site), cookieowl, installkite, a11ymedic, fontsketch and kastor.
Issues and pull requests are welcome. CONTRIBUTING.md explains the generator and src/components/CONVENTIONS.md covers components. Changes are listed in the CHANGELOG.