Menu

Theming

A theme is a CSS file of tokens. Swap the file and every component takes on the new look.

How a theme works

A theme is one CSS file, src/styles/uix.css. It is a Tailwind v4 theme: colour ramps, a type scale, spacing, radius and shadows, in light and in dark.

Components never use raw colours. They use named tokens such as bg-brand and text-fg-primary, and those point at the ramps. Change the file and every component changes with it.

Colour ramps

Each ramp runs from 50 (lightest) to 950 (darkest), for example --color-primary-500. The ramps are primary, secondary, neutral, and the feedback colours error, warning and success.

Semantic tokens

Semantic tokens say what a colour is for. Each one points at a ramp step, and the dark values are swapped in when data-theme="dark" is set. Here is a part of the default theme.

VariableTailwind classLightDark
--bg-canvasbg-canvasneutral-50neutral-950
--bg-surfacebg-surfacewhiteneutral-900
--bg-brandbg-brandprimary-600primary-500
--bg-brand-hoverbg-brand-hoverprimary-700primary-400
--bg-dangerbg-dangererror-500error-500
--text-primarytext-fg-primaryneutral-900neutral-50
--text-secondarytext-fg-secondaryneutral-600neutral-300
--text-on-brandtext-fg-on-brandwhitewhite
--text-brandtext-fg-brandprimary-600primary-400
--border-defaultborder-line-defaultneutral-200neutral-700
--border-focusborder-line-focusprimary-400primary-500

Spacing (--spacing-4), radius (--radius-md), fonts (--font-heading, --font-body, --font-mono) and the type scale (--text-heading-1, --text-body-large and so on) are tokens too.

Switch themes

One command swaps the theme. It rewrites src/styles/uix.css and updates the font links. Your components stay exactly as they are. Leave the name out, or use uix, for the default.

$ npx uix-ui@latest theme ember-ledger

Browse all of them on the themes page.

Try it

Pick a theme. The whole page changes with it, and so do the components below.

--bg-canvas
--bg-surface
--bg-brand
--bg-brand-hover
--bg-secondary
--bg-danger
--bg-success
--bg-warning
Paid

Customise tokens

Change a token in your own CSS, after the theme import. Do not edit uix.css: running init or theme writes it again.

src/index.css
@import "tailwindcss";
@import "./styles/uix.css";

/* Your changes go after the import. */
:root {
  --bg-brand: var(--color-primary-700);
  --radius-md: 6px;
}
[data-theme="dark"] {
  --bg-brand: var(--color-primary-400);
}

Prefer to keep the theme out of your source? The @uix-ui/tailwind package has the same themes: @import "@uix-ui/tailwind/themes/<preset>.css";.

Visual styles

UIX Pro. Visual styles change how the components look without touching your tokens: glass, clay, neon, brutalism and more. Set data-skin on html or on any wrapper, and everything inside it follows. Without it you get the Modern look. Add the styles once with UIX_LICENSE=<key> npx uix-ui add skins; the CLI imports them into your CSS.
index.html
<html data-skin="minimal" data-theme="dark">

<section data-skin="glass">
  <!-- components in here wear the Glass style -->
</section>

Pro also covers templates and blocks and all 251 themes. See pricing.

esc

↑↓ to navigate · ↵ to select · esc to close