Dark mode
NewOverview
Theme controls for light, dark, and system preferences.
<DarkMode.dark_mode_toggle id="example-dark-mode-toggle" />
Select
<DarkMode.dark_mode_select id="example-dark-mode-select" label="Example color theme" />
Add this module
mix dizzy.add dark_mode
Component API
DarkMode.dark_mode_toggle
Attributes
| Name | Type | Default | Values |
|---|---|---|---|
class |
:any
| nil | โ |
id |
:string
| Required | โ |
label |
:string
| "Dark mode" | โ |
DarkMode.dark_mode_select
Attributes
| Name | Type | Default | Values |
|---|---|---|---|
class |
:any
| nil | โ |
id |
:string
| Required | โ |
label |
:string
| "Color theme" | โ |
JavaScript hook
DizzyDarkMode
Shared by dark_mode_toggle and dark_mode_select. Reads the OS color preference, remembers explicit choices, follows OS changes, and synchronizes controls and browser tabs. Theme changes happen entirely in the browser.
mix dizzy.add includes the hook and performs
any required asset setup automatically.