Switch

Also known as: Toggle, On/Off switch

Preview

Resources

Properties

PropertyValuesDefault
Size Variant2Xs | Xs | SmSm
Selected VariantDefault | CheckedDefault
State VariantDefault | Hover | Focus | DisabledDefault
Start icon Booleantrue | falsefalse
End icon Booleantrue | falsefalse

When to use

If users need to make a binary action (on/off, switching color mode or enabling notifications).
When the setting doesn't require confirmation and takes effect immediately.
When multiple switches affect each other in a complex way, leading to confusion.
If user needs to take a non-binary action, such as choosing between "Daily" vs "Weekly" notifications, use radio button instead.

States

Switch (and all other forms and selection controls) express states. States indicate current condition of the component to someone interacting with it. Using states ensure clear user feedback, highlighting possible actions or barriers. We have included most common states:

StateContext
DefaultStatus of the component before the interaction. Also referred to as ‘resting’.
HoverWhen the user moves their cursor over the component, but is not taking the action. Slight visual change can indicate interactivity of the component.
FocusWhen user selects the component via keyboard navigation, but has not yet taken action on it.
DisabledA non-interactive state where the component appears faded or grayed out. It indicates that the action is unavailable at the moment.