API reference
defineTheme
API reference for the `defineTheme` method
These tokens are automatically turned into CSS custom properties
(i.e. --variables
) and placed into:
:root
for defaults:root[data-theme="themeName"]
for per-theme overrides- or
@media
,@container
selectors.
Example
Define tokens with theme-aware values.
- If
default
is defined, it's written to:root
- Each theme name becomes
:root[data-theme="name"]
- Keys are converted to kebab-case
Consuming themes in components
Use theme tokens in your components just like any other CSS variable.