components / switch
switch.
instant on/off toggle with role="switch", for settings that take effect the moment they move — as opposed to checkbox, which states an intent a submit later commits. square track, square knob.
installation
bunx @justin06lee/chrome@latest add switchprops
| name | type | default | description |
|---|---|---|---|
| checked * | boolean | - | |
| onChange * | (checked: boolean) => void | - | |
| label | ReactNode | - | text beside the track; clicking it toggles. |
| description | ReactNode | - | second line under the label. |
| labelPosition | 'start' | 'end' | 'end' | 'start' puts the label first and pushes the track to the far edge. |
| size | 'sm' | 'md' | 'md' | |
| disabled | boolean | false | |
| ariaLabel | string | - | accessible name when there is no visible label. |
| className | string | - |