Skip to content
Nana UI

Theming

Every component is styled from a shared set of design tokens exposed as CSS custom properties (all prefixed --nana-). Override them at any scope — the :root, a subtree, or a single element — to re-theme without touching component internals.

Import the token base once in your app’s global stylesheet:

@import "@nana-tec/ui-themes/base";

This defines the full token set: color scales, surface semantics, spacing, radii, typography, shadows, z-index, and transitions.

TokenRole
--nana-surface-bgComponent background
--nana-surface-textPrimary text color
--nana-surface-text-mutedSecondary text color
--nana-surface-borderBorders and separators
--nana-surface-subtleSubtle fills / hover backgrounds
--nana-color-primary-600Brand accent
--nana-radius-mdDefault corner radius
--nana-focus-ringFocus outline

Scope overrides to re-theme a subtree:

.checkout {
--nana-color-primary-600: #2563eb;
--nana-radius-md: 9999px;
}

Many components also expose component-scoped variables and ::part() hooks for finer control — see each component’s CSS Custom Properties section.

<nana-button style="--nana-button-bg:#2563eb">Buy now</nana-button>

Dark mode is driven by a single attribute on the document root:

document.documentElement.setAttribute("data-theme", "dark");

The token base ships :root[data-theme="dark"] overrides, so every component switches together. In these docs, Starlight’s theme toggle sets the same attribute, which is why the live examples follow the site theme.