Switch
Also known as: Toggle, On/Off switch
Preview
Resources
Properties
Property | Values | Default |
---|---|---|
Size Variant | 2Xs | Xs | Sm | Sm |
Selected Variant | Default | Checked | Default |
State Variant | Default | Hover | Focus | Disabled | Default |
Start icon Boolean | true | false | false |
End icon Boolean | true | false | false |
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:
State | Context |
---|---|
Default | Status of the component before the interaction. Also referred to as ‘resting’. |
Hover | When the user moves their cursor over the component, but is not taking the action. Slight visual change can indicate interactivity of the component. |
Focus | When user selects the component via keyboard navigation, but has not yet taken action on it. |
Disabled | A non-interactive state where the component appears faded or grayed out. It indicates that the action is unavailable at the moment. |