Inputs
ThemeToggle
Switches between light and dark through the colorScheme store. Built for the AppShell railBottom slot.
<script>
import { ThemeToggle } from "@codeatlasdev/ui";
</script>
<ThemeToggle />
The toggle reads and writes the colorScheme store, so call colorScheme.init() once in your root layout. The choice is saved to localStorage and applied before first paint by the theme script. The default name is localized.
Basic
Click it: the whole site flips between light and dark.
Code
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | 'Toggle color scheme' (localized) | Accessible name and tooltip. |
size | number | 18 | Icon size in px. |
class | string | – | Extra classes on the button. |