Skip to content
Norn
Menu

norn-theme-toggle

Light, system, or dark: a norn-segmented-control that sets the page's color-scheme and remembers the choice in localStorage under color-scheme. System clears the choice, so the visitor's setting decides. Every toggle on the page, and in other tabs, follows the same choice. Without a script it stays hidden and the page follows the system. Pass :@theme-toggle="true" to norn-head so a saved choice applies before the first paint. The names are in the page, hidden, and the script shows them, since the toggle only exists with a script. Each falls back to the site's componentStrings, then English.

<norn-theme-toggle> a component, from @allons-y/webc-patterns

Examples

Color scheme
Width

Open on its own

Source
<norn-theme-toggle></norn-theme-toggle>

Slots

NameDescription
label The group's name, as one element. Falls back to "Color scheme".
light The light option's name. Falls back to "Light".
system The system option's name. Falls back to "System".
dark The dark option's name. Falls back to "Dark".