@saali2901/cleanui
v2.3.0
Published
A token-driven CSS design system. Every HTML element designed, 25+ components, zero JavaScript, framework-agnostic.
Maintainers
Readme
Why cleanui
- One stylesheet, every element. Headings, tables, forms,
<details>,<dialog>— native HTML looks right without a single class. - Three-tier tokens. Primitive → semantic → component. Rebranding is a token remap; components never change.
- Your CSS always wins. Everything lives in
@layer cleanui. No!important, no specificity fights. - State lives in ARIA.
aria-selected,aria-current,aria-invalid,aria-presseddrive the visuals — accessible by construction. - Framework-agnostic. Plain class names; works in React, Vue, Svelte, Angular, Astro or static HTML.
- WCAG 2.2 AA. Contrast-checked tokens, visible focus, 24px+ targets, reduced-motion support.
- Calm motion. Short, purposeful transitions for opening, closing and dismissing — reduced-motion aware.
- Small. ~15 kB gzipped. Self-hosted variable font, no third-party requests.
Install
npm install @saali2901/cleanuiimport "@saali2901/cleanui";Or via CDN:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@saali2901/cleanui@2/dist/cleanui.min.css">Example
<div class="field">
<label class="field__label" for="email">Email</label>
<input class="input" id="email" type="email" aria-describedby="email-hint">
<p class="field__hint" id="email-hint">We never share your email.</p>
</div>
<div class="cluster">
<button class="btn">Cancel</button>
<button class="btn btn--primary">Continue</button>
</div>Theming
@layer cleanui.tokens {
:root {
--accent: #d43f5e;
--accent-hover: #b8314e;
--radius-control: 999px;
}
}Eight themes ship with cleanui — apply one to the whole app or to any subtree:
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@saali2901/cleanui@2/dist/themes/midnight.min.css">
<html data-theme="midnight">| Theme | Character |
| --- | --- |
| default | Ultramarine accent, cool graphite neutrals |
| midnight | Dark mode |
| coral | Friendly, rounded, rose-coral accent |
| paper | Editorial, warm paper, serif headings |
| harbor | Enterprise, petrol accent, compact controls |
| contrast | WCAG AAA text, 2px borders, 3px focus ring |
| forest | Green accent, pill controls |
| mono | Monochrome, square corners |
The build checks every theme's key color pairs against WCAG AA and fails if one is too weak.
What's inside
| Area | Contents |
| --- | --- |
| Foundations | Colors (incl. a 9-hue categorical palette), typography, spacing, radius, elevation, motion, z-index tokens |
| Layout | container, stack, cluster, grid, sidebar, section |
| Utilities | Flexbox (flex-center, flex-between, justify-*, items-*), spacing (p-4, mx-auto, gap-6), grid (grid-cols-3, col-span-2), typography, color roles, categorical colours (cat-*), responsive visibility (hide-below-md, hide-above-md), borders, position |
| Actions | Button, button group |
| Forms | Field, input, select, textarea, input group, checkbox, radio, switch, slider, file |
| Indicators | Chip, tag, badge, avatar |
| Feedback | Alert, progress, meter, spinner, skeleton |
| Navigation | Navbar, tabs, nav list, breadcrumb, pagination, dots |
| Overlays | Modal, drawer (<dialog>), menu, popover (Popover API), tooltip, toast |
| Content | Card, table, list, accordion, stat, timeline, empty state |
| Calendar | Month grid, week/day time grid, event chips, toolbar |
| Pickers | Swatches (colour picker), combobox (autocomplete) |
| Lists | Sortable list (drag handle, drop line, ↑/↓ buttons) |
| Process | Stepper, segmented control |
Naming
| Pattern | Example |
| --- | --- |
| Component | .btn, .card |
| Element | .card__title |
| Modifier | .btn--primary, .btn--small |
| State | aria-selected="true", :disabled |
| Token | --accent, --space-4 |
Development
npm install
npm run build # dist/ (CSS) + site/ (documentation)
npm run dev # build and serve the docs on http://localhost:4321The build fails if a raw color value appears outside src/tokens/ or src/themes/.
See CONTRIBUTING.md for the CSS rules and structure.
Browser support
Chrome/Edge 114+, Firefox 125+, Safari 17+. CSS anchor positioning, ::details-content and @starting-style are used as progressive enhancements.
License
MIT. The bundled typefaces are licensed under the SIL Open Font License 1.1: Schibsted Grotesk and Newsreader (Paper theme only).
