On/off toggle for settings that take effect immediately.
Binary preferences (notifications, feature flags) where the change applies without a separate Save step. For form submits with many fields, prefer Checkbox in a Field group.
Do
- Pair with a visible
labelon the same row. - Use for settings with immediate effect; disable during async saves.
- Set
variantto match semantic intent when using coloured track styling.
Don't
- Use switches for one-shot consent on a submit form — use checkbox + submit.
- Offer more than two states — use RadioGroup or Select.
<twig:Switch name="alerts" label="Email alerts" />Aligned with native switch / toggle patterns in modern design systems.
| Prop | Type | Default | Description |
|---|---|---|---|
variant |
string |
primary |
Semantic colour for the track |
checked |
bool |
false |
Initial on state |
disabled |
bool |
false |
Non-interactive |
Pass name, label, id, and native attributes on the tag.
- Label must be associated with the switch control.
- Do not rely on colour alone for on/off state — position and label carry meaning.