Component docs
Loading
"use client";
import { ThemeToggle } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
onValueChange (required) | (value: ThemeToggleValue) => void | — | Called with the new value (only when it changes). |
value (required) | ThemeToggleValue | — | Current value (controlled); null where it means "nothing selected". |
darkLabel | string | — | — |
lightLabel | string | — | — |
variant | ComponentVariant | — | Emphasis (solid, secondary, soft, outline, ghost). |
onValueChangerequired(value: ThemeToggleValue) => void
Called with the new value (only when it changes).
valuerequiredThemeToggleValue
Current value (controlled); null where it means "nothing selected".
darkLabelstring
lightLabelstring
variantComponentVariant
Emphasis (solid, secondary, soft, outline, ghost).
Other props are passed to the root element (ButtonHTMLAttributes<HTMLButtonElement>), including className, style, id and aria-* attributes.
const [theme, setTheme] = useState<"light" | "dark">("light");
<ThemeToggle value={theme} onValueChange={setTheme} />