Documentation
Asgard
Getting started
Theming
Guides
Inputs & forms
Pickers
Data display
Layout & docking
Feedback & overlays
Navigation & chrome
Theming
Every Asgard component reads its colors from the nearest ThemeProvider. A theme is a plain object of
tokens (backgrounds, text, borders, accents, semantic colors, per-component overrides), so you can use a
built-in palette or supply your own.
ThemeProvider
The simplest, controlled usage: pass a theme object and the provider renders exactly that.
ThemeProvider has no persistence of its own, it renders the theme you feed it. Persisting the choice
(localStorage, a Mimir atom, an ekko:rune store) is the app's job; just feed the saved value back into
theme.
Built-in palettes
themes (from @ekko/asgard/theme) is a map of ready-made palettes:
Switching theme is just changing which object you pass:
Reading the theme
Inside a component, useTheme() returns the active theme and setters:
useTheme() returns { theme, setTheme, themeName, setThemeName }. It must be called inside a
ThemeProvider.
Custom themes
A theme is just a typed object. Start from a built-in one and override what you need:
The token groups are background, text, border, accent, interactive, semantic, and a
components map for per-component overrides (sidebar, tab, toolbar, menu, tooltip, dropdown, scrollbar).
Nesting
Providers nest. Wrap a subtree in a second ThemeProvider to theme just that region, handy for a
preview pane or a differently-themed panel inside an otherwise neutral app.