Component docs
Loading
"use client";
import { Switch } from "@pixxl-tools/components";| Prop | Type | Default | Description |
|---|---|---|---|
label | ReactNode | — | Visible label (also the accessible name). |
className | string | — | Goes to the root <label> with style; ref, id and native attributes go to the input. |
onCheckedChange | ( checked: boolean, event: ChangeEvent<HTMLInputElement>, ) => void | — | Called with the new checked state (and the change event). |
onValueChange | ( value: boolean, event: ChangeEvent<HTMLInputElement>, ) => void | — | Called with the new value (only when it changes). |
size | ComponentSize | — | Size from the shared scale (xs, sm, md, lg). |
labelReactNode
Visible label (also the accessible name).
classNamestring
Goes to the root <label> with style; ref, id and native attributes go to the input.
onCheckedChange( checked: boolean, event: ChangeEvent<HTMLInputElement>, ) => void
Called with the new checked state (and the change event).
onValueChange( value: boolean, event: ChangeEvent<HTMLInputElement>, ) => void
Called with the new value (only when it changes).
sizeComponentSize
Size from the shared scale (xs, sm, md, lg).
Other props are passed to the root element (InputHTMLAttributes<HTMLInputElement>), including className, style, id and aria-* attributes.
Complex object props use fixed fixtures. Primitive props stay editable.
<Switch label="Preview" checked={true} disabled={false} /><Switch label="Preview" /><Switch label="Preview" checked={true} disabled={false} />