Components
← All components

Theme Toggle

stimeo--theme

Persists a light/dark/system choice and applies it to the root.

The stimeo--theme controller persists a light / dark / system choice to localStorage, follows the OS prefers-color-scheme while in system, and writes the resolved theme onto the root for the consumer's CSS — it ships no colors, only state hooks. The canonical contract is a 3-value radiogroup (use it whenever system is offered): each option is a role="radio" with aria-checked and a roving tabindex, navigable with the arrow keys (APG radio). A 2-value single button (aria-pressed) is offered only for light↔dark, since system cannot be expressed as a pressed/not-pressed toggle. It applies data-theme (resolved light/dark) and a matching color-scheme to the target (html by default), never moves focus, and watches matchMedia so system tracks live OS changes. It dispatches stimeo--theme:change and removes the matchMedia listener on disconnect (Turbo included). First-paint FOUC avoidance is a small inline <head> snippet, not this controller. Behavior only — the palette is this Playground's CSS keyed off data-theme.

running

Preview

This box is themed locally — the page itself is left untouched.

Keyboard

KeyAction
→ / ↓ Moves to and selects the next theme option (radiogroup).
← / ↑ Moves to and selects the previous theme option.
Home / End Selects the first / last theme option.
Enter / Space Activates the focused option (or toggles the single button).