Theme Mode

A theme mode system used to define and switch between different visual states across the layout, including base and alternate styling, class setup, and toggle controls.

Trigger

Elements used to switch between the default and alternate theme modes.
The Theme Mode trigger can be built with either a checkbox or radio buttons. These elements should follow the same setup rules used across the Toggle Buttons system, including the correct input structure, label setup, and active state behavior. For the full checkbox and radio button setup, see the Toggle Buttons page.
Checkbox
Theme
Light
Dark
Light
Dark
The attribute b-theme = toggle is added to the toggle-input element.
Radio Button
The attributes b-theme = default and b-theme = alternate are added to separate elements using the toggle-input class.

Target

Defines the page wrapper element where the base and alternate theme modes are applied.
The page-wrapper uses the base theme by default. Adding the is-alternate-mode class activates the alternate theme, while removing it restores the base theme. All nested elements with alternate-mode styling adapt automatically.
Base Mode
page-wrapper
Alternate Mode
page-wrapper
is-alternate-mode

Style Preview

Demonstrates how colors and interface elements adapt between the base and alternate theme modes.
Base Mode

Heading

Text Color Primary
Text Color Secondary
Text Color Tertiary
Background & Text Alternate
Link Alternate
Background Tertiary
Background Secondary
Alternate Mode

Heading

Text Color Primary
Text Color Secondary
Text Color Tertiary
Background & Text Alternate
Link Alternate
Background Tertiary
Background Secondary
Custom Behavior -
Theme Mode

Control the site’s default/alternate theme by adding or removing the is-alternate-mode class from the page-wrapper element.

Theme triggers are managed through the b-theme attribute. A checkbox using b-theme = toggle adds is-alternate-mode when checked and removes it when unchecked. Radio buttons use b-theme = default to remove the class and b-theme = alternate to add it.

The selected mode is saved in a cookie, so the visitor’s choice is remembered across pages and future visits. When the page loads, the code checks the saved cookie, applies the correct theme, and syncs all matching checkbox or radio triggers to the active state.

Supporting Custom Behavior

Custom behavior components required for this system to function correctly. These components are nested within
Global
so updates can be managed from one central location. Any edits made below will automatically apply across the site.
Custom Behavior -
Toggle Button

Synchronize each toggle’s visual state with its checkbox or radio input. Each element with the toggle-input class is connected to its closest b-toggle = group wrapper. When the input is checked, is-checked is added to the wrapper and to any nested elements marked with b-toggle = state. When the input is unchecked, is-checked is removed from the wrapper and from all nested b-toggle = state elements. Use b-toggle = state only on elements that need to visually change, such as text, tracks, thumbs, icons, cards, or labels. This behavior supports checkbox toggles and radio button groups. The correct state is synchronized on page load without triggering unwanted animations. View the full documentation for setup, structure, and usage details.