Appearance
ThemeSwitcher
Radio-style UI to switch between light, dark, and auto themes.
Usage
html
<div data-component="ThemeSwitcher"></div>Behavior
- Updates the global store key
themewith one of: "light" | "dark" | "auto". main.tsapplies the theme to<html data-theme="...">, honoring system preference for "auto".
Accessibility
- Uses
role="radiogroup"androle="radio". - Supports keyboard navigation with Arrow keys (roving tabindex).
aria-checkedreflects the current selection.
Examples
Programmatically set the theme:
ts
import { store } from "../../src/js/store";
store.set("theme", "dark");
// or
store.set("theme", "light");
// or
store.set("theme", "auto");See also: Docs Index | All Components