ui-kit0.0

Foundations

Colour & tokens

Two-layer tokens, dark mode and accents.

Two layers

  • Palette — raw OKLCH colours (--ui-gray-50…1000, --ui-violet-600…). Never used by components directly.
  • Semantic roles — what a colour is for (--ui-surface, --ui-muted-foreground, --ui-destructive-text). Components only read these, so a theme only remaps roles.
  • Fills and text are separate where one colour can’t do both: a red that carries white text (≥ 4.5:1) is too dark to read as text on a dark page, so dark mode uses -text tokens for text.

Every role is also a Tailwind colour: bg-card, text-muted-foreground, border-input, text-destructive-text, bg-series-1. Switch the theme and accent in the top bar — this page updates live.

Surfaces

--ui-background

Page

--ui-surface

Cards (bg-card)

--ui-surface-raised

Menus, popovers, dialogs (bg-popover)

--ui-surface-muted

Wells, table headers (bg-muted)

--ui-foreground

Body text

--ui-muted-foreground

Secondary text

Interactive

--ui-primary

Primary fill — follows the accent

--ui-primary-text

Links and accent text

--ui-secondary

Secondary fill

--ui-accent

Hover / highlighted item

--ui-ring

Focus ring

--ui-control-on

Checked switch, checkbox, slider

Lines

--ui-border

Default 1px line

--ui-border-subtle

Lines inside a surface

--ui-border-strong

Inputs (border-input)

Status

--ui-destructive

Fill for destructive actions

--ui-destructive-text

Error text on surfaces

--ui-success

Fill

--ui-success-text

Text on surfaces

--ui-warning

Fill (dark text on top)

--ui-warning-text

Text on surfaces

--ui-info

Fill

--ui-info-text

Text on surfaces

Data series

--ui-series-1

Chart series 1

--ui-series-2

Chart series 2

--ui-series-3

Chart series 3

--ui-series-4

Chart series 4

--ui-series-5

Chart series 5

--ui-series-6

Chart series 6

Accents and dark mode

Dark mode is the dark class on <html>. Accents are data-accent on <html> or any subtree: violet, blue, emerald, rose, amber, orange. Every accent fill and text colour was measured at ≥ 4.5:1 in both modes.

// app/layout.tsx
import { ThemeScript } from 'ui-kit';

<html lang="en" suppressHydrationWarning>
  <head><ThemeScript /></head>   {/* applies the saved theme before paint */}
  <body>{children}</body>
</html>

// any client component
const { mode, resolvedMode, accent, setMode, setAccent, toggle } = useTheme();

Your own colours

/* after ui-kit's CSS */
:root {
  --ui-primary: oklch(0.55 0.2 250);
  --ui-primary-text: oklch(0.55 0.2 250);
  --ui-radius: 0.75rem;
}
.dark {
  --ui-primary-text: oklch(0.72 0.15 250);
}