Foundations
Theme packs
Whole-look presets: colour, radius and type.
What a pack changes
A theme pack changes the whole look in one attribute: the colour map in light and dark, corner radius, shadows and, for Mono, the display face. It only overrides semantic tokens (--ui-*), so every component follows without a line of component CSS changing.
- Put
data-theme="stone"on<html>for the whole app, or on any element to theme just that subtree. - Packs compose: dark mode (
.dark) picks the pack’s dark map, and an accent (data-accent) replaces the pack’s primary colour, focus ring and checked controls. neutralis the default look. Setting it on a subtree resets that subtree inside another pack.
Try it on this site
Saved in this browser and applied before paint on every page.
All packs
Each pack renders the same real components twice, in light and in dark, using data-theme on the preview. The site’s accent applies too: pick one in the top bar to see it combine with every pack.
Neutral
data-theme="neutral"The default. Cool zinc greys, 10px corners, quiet shadows. Same as no attribute.
Light
Team plan
12 seats · renews 14 December
Dark
Team plan
12 seats · renews 14 December
Stone
data-theme="stone"Warm greys and a paper-white page, 8px corners, warm-tinted shadows. Editorial, calm.
Light
Team plan
12 seats · renews 14 December
Dark
Team plan
12 seats · renews 14 December
Slate
data-theme="slate"Cool blue-greys with a navy dark mode, crisper 6px corners and tight shadows. Dashboards.
Light
Team plan
12 seats · renews 14 December
Dark
Team plan
12 seats · renews 14 December
Soft
data-theme="soft"Lavender-tinted page under white cards, a muted indigo primary, 14px corners, diffuse shadows.
Light
Team plan
12 seats · renews 14 December
Dark
Team plan
12 seats · renews 14 December
Mono
data-theme="mono"Brutal-lite: pure greys, ink-black primary, strong borders instead of shadows, small corners, monospaced headings.
Light
Team plan
12 seats · renews 14 December
Dark
Team plan
12 seats · renews 14 December
Usage
// app/layout.tsx — a fixed pack for the whole app
<html lang="en" data-theme="slate" suppressHydrationWarning>
<head><ThemeScript /></head> {/* applies saved mode, accent and pack before paint */}
<body>{children}</body>
</html>
// a subtree
<section data-theme="soft">…</section>
// let people choose (saved under localStorage "ui-theme-pack")
import { THEME_PACKS, useTheme } from 'ui-kit';
const { pack, setPack } = useTheme();
<select value={pack} onChange={(e) => setPack(e.target.value)}>
{THEME_PACKS.map((p) => <option key={p}>{p}</option>)}
</select>A pack the server rendered on <html> stays until the person picks another one with setPack; picking neutral removes it.
Dark mode, accents and nesting
- Dark —
.dark(ordata-theme-mode="dark") on the same element or any ancestor switches the pack to its dark map. A.darksubtree inside a pack gets that pack’s dark map. - Light inside dark —
data-theme-mode="light"on the same element asdata-themekeeps a subtree light on a dark page (the previews above do this). It only works together with a pack; usedata-theme="neutral"for the default look. - Accents — an accent on the same element or an ancestor always wins over the pack’s primary. Every accent was measured on every pack surface at ≥ 4.5:1.
- Nesting — the nearest
data-themewins. Mono’s monospaced headings do not leak into a nested pack.
Make your own pack
A pack is a ramp of 14 tones plus the knobs you want to change. Everything else (light and dark maps, accent hand-off, focus ring, radius steps) comes from the engine, so a pack can’t get the precedence wrong. Load it after ui-kit’s CSS.
[data-theme="forest"] {
/* 1. Tone ramp, lightest → darkest (one hue, low chroma) */
--ui-tone-0: oklch(1 0 0);
--ui-tone-50: oklch(0.984 0.004 155);
--ui-tone-100: oklch(0.965 0.007 155);
--ui-tone-150: oklch(0.942 0.009 155);
--ui-tone-200: oklch(0.918 0.011 155);
--ui-tone-300: oklch(0.866 0.015 155);
--ui-tone-400: oklch(0.703 0.025 155);
--ui-tone-500: oklch(0.515 0.028 155); /* muted text: ≥ 4.5:1 on tone-100 */
--ui-tone-700: oklch(0.37 0.025 155);
--ui-tone-800: oklch(0.275 0.02 155);
--ui-tone-850: oklch(0.237 0.018 155);
--ui-tone-900: oklch(0.212 0.016 155);
--ui-tone-925: oklch(0.186 0.014 155);
--ui-tone-950: oklch(0.145 0.012 155);
/* 2. Only the knobs you want to change; -dark for dark mode */
--ui-pack-radius: 0.5rem;
--ui-pack-primary: oklch(0.45 0.1 155);
--ui-pack-primary-foreground: oklch(1 0 0);
--ui-pack-primary-text: oklch(0.45 0.1 155);
--ui-pack-primary-dark: oklch(0.8 0.12 155);
--ui-pack-primary-foreground-dark: var(--ui-tone-950);
--ui-pack-primary-text-dark: oklch(0.8 0.12 155);
}Then use data-theme="forest" or setPack('forest'). Measure every text pair (foreground and muted text on background, surface and surface-muted; primary-foreground on primary) at ≥ 4.5:1 in both modes before shipping.
Knobs
| Prop | Type | Default | Description |
|---|---|---|---|
| --ui-tone-0 … 950 | colour ramp | gray palette | 14 steps: 0, 50, 100, 150, 200, 300, 400, 500, 700, 800, 850, 900, 925, 950. Most roles derive from it. |
| --ui-pack-radius | length | 0.625rem | Becomes --ui-radius and every --radius-* step. |
| --ui-pack-background | colour | tone-0 · tone-950 | Page. Light value; add -dark for dark mode (same for every row below). |
| --ui-pack-surface(-raised|-muted) | colour | tone-0 · 925 / 900 / 850 | Cards, floating layers, wells. |
| --ui-pack-foreground | colour | tone-950 · tone-50 | Text on every surface. |
| --ui-pack-muted-foreground | colour | tone-500 · tone-400 | Secondary text. Keep ≥ 4.5:1 on surface-muted. |
| --ui-pack-primary(-foreground|-text) | colour | tone-900 / 50 / 900 | Brand fill, text on it, brand-coloured text. An accent replaces these. |
| --ui-pack-secondary(-foreground) | colour | tone-100 / 900 | Secondary fill and its text. |
| --ui-pack-accent | colour | tone-100 · tone-800 | Hover / highlighted item. |
| --ui-pack-border(-subtle|-strong) | colour | tone-200 / 150 / 300 | Lines; -strong is the input outline. |
| --ui-pack-ring | colour | tone-400 · tone-500 | Focus ring. An accent replaces it. |
| --ui-pack-control-track | colour | tone-200 · tone-700 | Off-state track of switches and sliders. |
| --ui-pack-sidebar(-border|-accent) | colour | tone-50 / 200 / 150 | App chrome. |
| --ui-pack-shadow-xs|sm|md|lg | shadow | neutral shadows | Floating layers only. Use 0 0 0 0 transparent, not none, for no shadow. |
| --ui-pack-overlay | colour | ink at 45% · black at 60% | Dialog and sheet backdrop. |
Accessibility
- Every built-in pack keeps body text, muted text, primary text and status text at ≥ 4.5:1 on its page, card and muted surfaces, in light and dark (lowest pair: 4.98:1, muted text on Soft’s hover fill).
- Packs never change sizes, spacing or motion, so hit targets and reduced-motion behaviour are identical in every pack.
- Mono replaces shadows with strong borders, so floating layers stay distinct from the page without relying on elevation.