Theming
Swap the brand color across every component by passing a NoriTheme to NoriProvider — choose a bundled preset or roll your own.
Try it now
See the floating swatch picker in the bottom-right corner? Click any
color and every component on the page re-renders against that preset.
Your choice persists across reloads (stored in localStorage).
At a glance
- A
NoriThemeis a paired light/dark palette:{ light: Theme, dark: Theme }. The hookuseThemeColors()resolves the right half based on the current color scheme. - Pass a theme to
<NoriProvider theme={...}>(or<ThemeProvider theme={...}>directly) and every component below it picks it up — buttons, sliders, switches, toasts, the lot. - Six bundled presets — teal (default), blue, rose, violet, orange, slate — exported by name from
@nori-ui/core. - Custom theme: spread
defaultThemeand override the colors you care about. Most of the time you only need to touch theprimaryramp.
Limitation: className-only paths don't theme yet
The Tailwind preset compiles colors at build time. Components that
style themselves only via class names (e.g. bg-semantic-interactive-primary)
won't follow <ThemeProvider> overrides — they keep the build-time palette.
In practice, every interactive component in @nori-ui/core also sets
its key colors inline via useThemeColors(). Inline styles win on CSS
specificity, so the visible color matches the active theme. Wholesale
re-skin via CSS variables is on the roadmap.
Themes change more than just color
Spacing, border radius, font size, font weight, font family, line height — every dimensional and typographic token a component touches comes from the active theme. Override the tokens in your custom theme and every component reshapes accordingly:
Use a preset
Available presets:
presetThemes is also exported as an object keyed by name — handy for theme pickers:
Build a custom theme
The presets only swap the primary ramp; the neutral / semantic / status
colors stay shared across all themes. Build your own by spreading the
default and overriding what you need:
Switching themes at runtime
Themes live in React context, so swapping the prop is enough — every descendant re-renders with the new palette. No CSS variable thrash, no flash on switch.
Theming + color scheme
Themes are independent from the light/dark color scheme. The same
NoriTheme covers both — useColorScheme() picks which half is active.
Toggle dark mode the way you already do (e.g. add class="dark" to
<html>); the active theme follows.