Layout
ThemeSwitcher
Floating theme and dark/light picker, with the same panel, labels and rows as a dropdown. Several on one page stay in step. Drives data-theme and data-mode on <html> and remembers the choice. A switch lands all at once, crossfaded where the browser has view transitions. It needs every theme in your CSS: run init with --themes=all. ThemeScript sets the attributes before paint; add suppressHydrationWarning to your <html>.
Preview
Active theme: entrepta, dark mode.
Click it. It is the same switcher as the one in the corner, and they stay in step.
Installation
Resolves dependencies, copies the source, and installs npm packages automatically.
Usage
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| themes | ThemeOption[] | - | List of themes. Each `{ id, label, color, lightColor? }`. Required. |
| defaultTheme | string | themes[0].id | Theme id to use when nothing is stored. |
| defaultMode | "dark" | "light" | "dark" | Initial mode when nothing is stored. |
| storageKey | string | "entrepta" | Prefix for the two localStorage keys (`:theme`, `:mode`). |
| position | "bottom-right" | "bottom-left" | "top-right" | "top-left" | "bottom-right" | Where the floating trigger anchors. |
| hideModeToggle | boolean | false | Hide the dark/light section and the mode label on the trigger. |
| disableMode | boolean | false | Lock mode to `defaultMode`. Useful for dark-only sites. |