"use client";
import { ThemeSwitcher } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
size | "md" | "sm" | sm | Size from the shared scale (xs, sm, md, lg). |
cookieDomain | CookieDomainOption | — | Cookie domain when the switcher persists on its own (no provider): { shared: ".gtktsc.com" } (that domain's sites, host-only elsewhere) or a domain string. |
defaultValue | ThemePreference | — | Initial value when uncontrolled. |
fullWidth | boolean | — | segmented only: fill the container with equal options, e.g. in a settings dialog. Shows the words: below 22rem the icons drop out and the padding tightens; below 17rem (a 320 px phone) Light and Dark share one row and System takes a second; below 11rem each option has its own row. |
iconOnly | boolean | true (false with fullWidth) | segmented only: icons with accessible names and tooltips, no visible words. Default true, or false with fullWidth. |
label | string | "Theme" | Group / select label (default "Theme"). |
onValueChange | (theme: ThemePreference) => void | — | Called with the new value (only when it changes). |
options | readonly ThemePreference[] | light, dark, system | Options for segmented and select (default light, dark, system). |
storageKey | string | — | localStorage key when the switcher persists on its own. |
value | ThemePreference | — | Current value (controlled); null where it means "nothing selected". |
variant | ThemeSwitcherVariant | Light / Dark / System radio group | segmented (default: Light / Dark / System radio group), select, or toggle: one icon button that cycles system → the opposite of the OS scheme → the OS scheme → system. The toggle is for compact app toolbars, not site headers: use SiteHeader themeSwitcher there. |
sizedefault sm"md" | "sm"
Size from the shared scale (xs, sm, md, lg).
cookieDomainCookieDomainOption
Cookie domain when the switcher persists on its own (no provider): { shared: ".gtktsc.com" } (that domain's sites, host-only elsewhere) or a domain string.
defaultValueThemePreference
Initial value when uncontrolled.
fullWidthboolean
segmented only: fill the container with equal options, e.g. in a settings dialog. Shows the words: below 22rem the icons drop out and the padding tightens; below 17rem (a 320 px phone) Light and Dark share one row and System takes a second; below 11rem each option has its own row.
iconOnlydefault true (false with fullWidth)boolean
segmented only: icons with accessible names and tooltips, no visible words. Default true, or false with fullWidth.
labeldefault "Theme"string
Group / select label (default "Theme").
onValueChange(theme: ThemePreference) => void
Called with the new value (only when it changes).
optionsdefault light, dark, systemreadonly ThemePreference[]
Options for segmented and select (default light, dark, system).
storageKeystring
localStorage key when the switcher persists on its own.
valueThemePreference
Current value (controlled); null where it means "nothing selected".
variantdefault Light / Dark / System radio groupThemeSwitcherVariant
segmented (default: Light / Dark / System radio group), select, or toggle: one icon button that cycles system → the opposite of the OS scheme → the OS scheme → system. The toggle is for compact app toolbars, not site headers: use SiteHeader themeSwitcher there.
Other props are passed to the root element (HTMLAttributes<HTMLElement>), including className, style, id and aria-* attributes.
Complex object props use fixed fixtures. Primitive props stay editable.
<ThemeSwitcher />Selected: system
<ThemeSwitcher /> // icons with names and tooltips
<ThemeSwitcher fullWidth size="md" /> // settings dialog: words<ThemeSwitcher />