Auto-Initialized Toggle
This control uses the library data attribute API with the toggle layout and local storage. It switches the full document theme through the default root selector.
localStorage with the library storage key.
Download This Plugin Back To jQueryScript
Create a Bootstrap 5 dark mode switch with local storage, custom color modes, and support for jQuery or vanilla JS.
This control uses the library data attribute API with the toggle layout and local storage. It switches the full document theme through the default root selector.
localStorage with the library storage key.
This control is created through HTMLElement.bsDarkmodeToggle(). The buttons below call the plugin methods for light, dark, toggle, and storage switching.
This control targets two separate surfaces through one selector. It uses a button layout, no storage, custom icon labels, and custom color mode names to prove the root and color mode options work beyond the document theme.
The same control updates every matched root. Custom color mode names drive this isolated surface without changing the page theme.
The library applies the selected mode to each matching node, which makes synchronized theme islands straightforward.
Each plugin instance dispatches a bubbling change event when its state changes through the public API or user interaction. Silent internal updates do not appear here.
Waiting for interactions...