Use it for a setting that takes effect at once. The value is checked. Put the Switch first inside a Label, so the full row toggles it.
The sample also uses Label. One command adds them with this item:
public-profile-switch.tsx
Switch
<span>| Prop | Type | Default | Description | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| rounded | "default""full" | "full" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| size | "default""lg""sm" | "default" | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| class | string | — | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
From Base UISwitch.RootBase UI docs | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| id | string | — | The id of the hidden input element. When nativeButton is true, the id is applied to the root element. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| checked | boolean | — | Whether the switch is currently active. To render an uncontrolled switch, use the defaultChecked prop instead. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| default | boolean | false | Whether the switch is initially active. To render a controlled switch, use the checked prop instead. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| ...props | <span> attributes | — | Every other attribute goes to the <span>, with a ref. | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| Space | Turns the switch on or off. |
|---|---|
| Enter | Turns the switch on or off. |
- CheckboxPick Checkbox for an option in a form that takes effect only when people press Save or Submit.
- LabelNames a control that is not in a Field, such as a checkbox or a switch row. It has the look of form labels and fades when its control is disabled.
- TogglePick Toggle for an on or off button with an icon or a label in a toolbar, such as bold or pin.





