Axon 911 Frontend DocsAxon 911 Frontend Docs
Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Primitives
  2. Theme
  3. API and Development

Theme

API and Development

View SourceOpens in a new tabSubmit IssueOpens in a new tab
Appearance is the data-theme attribute on the document element. Light token values are declared on :where(:root). Dark token values are declared under [data-theme='dark']. There is no ThemeProvider and no brand class on the document. createAppearancePreference from @prepared911/ui applies AppearanceMode.Light, AppearanceMode.Dark, or AppearanceMode.System. The first application does not animate. Later changes go through transitionAppearance. Persisting the choice is the caller's job.
Example
preference.mode is the last mode passed to set, or the initial mode. dispose() stops following the system setting. A region that must stay on one appearance uses themeRegionProps(ThemeRegionAppearance.Light) or ThemeRegionAppearance.Dark from @prepared911/ui. That region does not restyle popups portaled outside it. Import @prepared911/ui/tokens.css once so the custom properties exist. Import @prepared911/ui/appearance-transition.css after it when the animated appearance change should use the design system's rise, rather than the browser's default cross-fade.
Previous
Theme / Usage
Next
Theme / Accessibility
On this page
Example