Layout
ModeToggle
Dark/light switch with no theme picker. Drives data-mode on <html> and remembers the choice. The whole page changes at once, crossfaded where the browser has view transitions. Inline by default, or floating with position. ModeScript sets the mode before paint; add suppressHydrationWarning to your <html>.
Preview
icon
labeled
Installation
Resolves dependencies, copies the source, and installs npm packages automatically.
Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| variant | "icon" | "labeled" | "icon" | `labeled` adds the current mode name next to the glyph. |
| size | "sm" | "md" | "md" | Height and padding scale. |
| position | "bottom-right" | "bottom-left" | "top-right" | "top-left" | - | Anchors the button to a screen corner. Omit to keep it inline. |
| defaultMode | "dark" | "light" | "dark" | Mode to use when nothing is stored. |
| storageKey | string | "entrepta" | Prefix for the localStorage key (`:mode`). Match it to ThemeSwitcher. |
| onModeChange | (mode: ThemeMode) => void | - | Fires after the mode changes. |