{{-- Switches the colour theme through `$store.theme` (resources/js/theme.js), so every toggle on a page reads and writes the one choice and none needs an id. `mode`: - `toggle` (the default): an icon button between light and dark. The icon is where it takes you — a sun while the page is dark, a moon while it is light — and it is a toggle button, "Dark theme", pressed while dark. - `cycle`: an icon button that steps light → dark → system, showing the choice it is on. - `picker`: M3's segmented buttons for the three choices, for a settings page. The theme is the visitor's, known only in the browser, so the parts that depend on it wait for Alpine (`x-cloak`) rather than render a guess. `class` lands on the button or the group. --}} @props([ 'mode' => 'toggle', ]) @php $mode = in_array($mode, ['toggle', 'cycle', 'picker'], true) ? $mode : 'toggle'; @endphp @if ($mode === 'picker')
class(['inline-flex h-10 rounded-corner-full border border-outline']) }} > @foreach (['light' => ['Light', 'light_mode'], 'dark' => ['Dark', 'dark_mode'], 'system' => ['System', 'brightness_auto']] as $choice => [$text, $icon]) @endforeach
@else @endif