Switch
Loading example…
Switch is part of the Atoms set, imported from @jcsoftdev/ui/atoms.
Import
Section titled “Import”import { Switch } from "@jcsoftdev/ui/atoms";Single-component entry points tree-shake to just this component: @jcsoftdev/ui/atoms/switch.
<Switch aria-label="Recordatorios por WhatsApp" />| Prop | Type | Default | Description |
|---|---|---|---|
classNames |
Partial<Record<SwitchPart, string>> |
Per-part classes merged with cn; consumer classes win. className still targets the root and is merged last. |
|
checked |
boolean |
||
defaultChecked |
boolean |
||
onCheckedChange |
((checked: boolean) => void) |
||
required |
boolean |
||
name |
string |
||
value |
string |
"on" |
|
form |
string |
Id of the <form> the switch belongs to when it is rendered outside it. |
|
label |
ReactNode |
||
description |
ReactNode |
||
intent |
string |
||
intentKey |
string |
* marks a required prop.
It also accepts the native props of the element or primitive it renders (for example className, id, aria-* and event handlers).
Storybook stories
Section titled “Storybook stories”- Default
- On
- Disabled
- Disabled On
- Controlled
- Form Submit And Reset
- Touch Hit Area
- With Label And Description
Source
Section titled “Source”packages/ui/src/atoms/switch/switch.tsx