Toggle a setting
Use switches for binary settings such as on or off.
Use switches for binary settings such as on or off.
A switch takes effect when users change it.
The thumb position and colour help users see whether the setting is on or off.
Switch
Label
The switch reflects its on or off state visually and applies the change immediately.
Renders the switch in its active on state. Use when a setting should take effect immediately without a separate save action.
Switch sizes let you match the toggle to the density of the surrounding layout.
The default size. Use in most form layouts and settings panels.
An optional icon inside the switch thumb reinforces the on or off state.
The default. Use when the switch position alone is sufficient to communicate the state.
Use the disabled state to prevent toggling when the setting is not available in the current context.
The default. Switches are interactive and can be toggled by the user.
Switch labels can sit on the default side or in the left label slot depending on the form layout.
Use the default label position for simple stacked forms.
Each row is a colour, spacing, or size value the component uses, and the right-most column tells you where in the component you'll see it.
sgds-form-border-width-defaultWidth variessgds-outline-focus—sgds-outline-offset-focus—sgds-form-border-radius-full—sgds-form-height-mdHeight variessgds-form-width-xsWidth variessgds-form-width-xlWidth variessgds-switch-heightHeight variessgds-switch-widthWidth variesUse a switch when toggling should change the system right away, like turning on notifications.
If the change only takes effect after submission, use a checkbox so the convention matches pending-save.
Phrase the label as the on-state behaviour, Enable two-factor authentication, so the result is clear.
Avoid labels like On or Yes. The label should describe the setting that the switch controls.
Use the icon prop to show a check or cross inside the thumb when users need a cue beyond colour.
A switch is binary. For more than two values (Off, Low, High), use radio buttons or a select instead.
disabled states.TabShift+TabEnterSpaceShare them with us on Slack → #ask-sgds-v3
Report it on GitHub Issues → sgds/components/switch
The Singapore Government Design System was developed to empower teams in creating fast, accessible and mobile-friendly digital services.