Switch

v2.1.1

Switches provide a binary on/off choice. Their input is immediate and requires no additional action.

Stylized artwork of two switches with labels.

Anatomy

Switch diagram with 2 elements numbered: 1. Label, 2. Switch.
  1. Label
  2. Switch

Properties

Label

Switches should always have a label associated with them. The label should clearly indicate what is being activated.

An unselected switch with a label.

Selected

Switches appear as either selected (on) or unselected (off). Switches cannot be in an indefinite state.

An unselected switch sits above a selected switch.

Disabled

Switches can be disabled in either a selected or unselected state if there is a prerequisite to altering its state.

A disabled unselected switch sits above a disabled selected switch.

Behavior

Immediate

Switches immediately update the state of the application when their state changes. If a delay is necessary, a loading indicator should be used to inform the user that the process is taking longer.

A ‘Face ID sign in’ selected switch sits in the security section of the eBay app.

Labels

Avoid using the words “on” or “off” within the label. Switches imply an on/off state so including it in the label is redundant.

It is okay to use labels with verbs that clarify the decision if it isn’t a clear on/off decision, like “Show” or “Notify”.

3 switches with labels: ‘Auto-detect country’ with an unselected switch, ‘Show new layout’ with a selected switch, and ‘Notify me when I receive an offer’ with a selected switch.

Platforms

Platform-specific

Native platforms use the operating system’s default visual treatment. The behavior and options remain the same across platforms.

Web, Android, and iOS switches are shown with examples of their selected and unselected states.

Best practices

Labels

Do use clear and concise labels.

‘Facial ID sign in’ selected switch

Avoid using action-related verbs with “on” or “off” when adding labels to controls. Switches imply an on/off state so including it in the label is redundant.

‘Turn on Facial ID sign in’ selected switch

Placement

Do use switches as trailing elements.

‘Auto-detect’ selected switch with the switch to the right.

Don’t use switches as leading elements.

‘Auto-detect’ selected switch with the switch to the left.

Do ensure switches are either aligned with the grid or with each other when multiple switches are stacked.

Three stacked switches with labels aligned to the left and switches aligned to the right.

Don’t misalign switches by placing them immediately after labels when multiple switches are stacked, as this can affect legibility.

Three stacked switches with labels aligned ot the left and switches aligned right after each label, creating a staggered effect.

Checkbox or switch

If the action is part of a larger form, use a checkbox instead. The items will be submitted with the rest of the form details.

Three checkboxes with distinct labels, one unselected and two selected, are stacked in a list.

Switches apply changes immediately and don’t require the user to submit anything. If you need to include the data in form content, use a checkbox set.

Three switches with distinct labels, one unselected and two selected, are stacked in a list.

Radio button or switch

Switches are used for activation, not selection. If you are selecting between two available options, use a radio set instead.

A ‘List view’ selected radio button sits above a ‘Grid view’ unselected radio button.

Switches should not be used to choose between opposing or discrete options. Instead, use switches for on/off situations.

An unselected switch with two labels, ‘List view’ on the left, and ‘Grid view’ on the right.

Specs

A switch component is shown with specs highlighted. Space between the Label and Switch is 16px, and height of Switch is 24px.

Change log

VersionDateNotes
2.1.1
Sep, 2024
  • Updated to eBay Evo
2.1.1
Jun, 2022
  • Fixed tokens used in web version
  • Fixed dark mode switch to use dark version of bg.primary
2.1.0
Mar, 2022
  • Updated web switch outline to be bolder
  • Updated switches to use bg.accent when switched on
2.0.0
Jan, 2022
  • Updated to Evo styling
  • Updated on state to use core.neutral.7