Dark mode toggle
An Alpine-powered control that toggles the .dark class on <html>. It renders x-slate::button, so every button prop works here too.
The preferred theme is stored in localStorage under slate-theme (dark / light) and restored on load. Include a small boot script in your layout <head> (see the docs site theme-init component) to avoid a flash of the wrong theme.
Usage
Defaults are variant="ghost" and size="icon".
Variants
Sizes
Props
Same as Button: variant, size, rounded, animation, as, type, plus any HTML attributes (class, etc.).
Requirements
Alpine.js must be loaded on the page. Livewire 3 projects include Alpine by default.