Switches

Cross-platform differences

Comparison of the switch on Android and iOS. The Android switch is shown as a standalone component with no label, while the iOS switch is shown within a list row that includes a placeholder icon, a label, and the switch aligned to the trailing edge.
  • Spectrum builds the Android switch as a standalone component without a label, aligning with the Material implementation. On iOS, Spectrum implements the switch as a list row with a label and optional icon, aligning with Apple's guidelines.
  • Spectrum Android’s switch includes the minimum 48×48 dp tap target size outside the switch’s visual size, aligning with platform accessibility standards.

Anatomy

Anatomy diagram of the switch on Android and iOS. Top row: the Android switch on, with track and thumb labeled; the iOS switch on, in a list row with icon, label, row divider, track, and thumb labeled. Bottom row: the same components in their off states, with the Android track and thumb shown in gray and black, and the iOS row's icon, label, track, and thumb shown in muted gray tones.

Component options

Property
Value
Description
Is on
Boolean
-
Text
String
iOS only
Icon
-
iOS only
Scale icon with text
Boolean
iOS only

Is on

This boolean option allows you to set the switch to “on” or “off.”

On and off states of the switch on Android and iOS. On Android, the on state shows a blue track with a white thumb, and the off state shows a light gray track with a black thumb. On iOS, both states are shown within a labeled list row; the on state shows a blue track with a white thumb, and the off state shows a light gray track with a white thumb.

Enabled

This boolean option allows you to set the switch to be enabled or disabled. It applies to both the on and off states.

Enabled and disabled states of the switch on Android and iOS, each shown in both on and off positions. Enabled states use full color saturation for both platforms. Disabled states are shown with reduced opacity and muted colors, with the Android track appearing gray and the iOS track appearing a lighter, desaturated blue when on.

Text

This iOS-only option sets the row label that describes what the switch controls. The label is required.

Icon

This iOS-only option controls the presence of a leading icon that sits before the switch’s label.

A list row with a cloud icon, the label 'Cloud sync,' and a switch in the on position.

Haptics & motion

  • Switches support native OS haptic feedback when turned on or off.
  • The thumb slides left or right as the user toggles the switch.

Usage guidelines

Do use within a list

In most cases, switches should be used within a list. They should always have an adjacent label for accessibility and clear comprehension.

Do use the correct selection control

Switches are best for communicating activation (e.g., turning a setting on or off). Checkboxes are best for communicating selection (e.g., selecting multiple items from a list). Radio buttons are best when only one option can be selected at a time from a set (e.g., choosing one preference or mode). On iOS, checkboxes and radio buttons aren't native controls. Multi-select and single-select are typically shown as list rows with a checkmark, or with pickers and segmented controls.

Internationalization

Comparison of the switch in left to right and right to left layouts, on Android and iOS, each shown on and off. In left to right layouts, the on state's thumb sits on the right side of the track, and the iOS list row order is icon, then label, then switch. In right to left layouts, this is mirrored: the on state's thumb sits on the left side of the track, and the iOS list row order becomes switch, then right-aligned Arabic label, then icon on the far right.

In right-to-left (RTL) languages such as Arabic and Hebrew, switches mirror their layout to match the reading direction.

Layout

  • Label and icon: In RTL, the icon moves to the right edge and the label reads from right to left. In LTR, the icon sits on the left.
  • Switch position (iOS): In LTR, the switch sits at the trailing (right) edge of the row. In RTL, it moves to the trailing (left) edge, opposite the label and icon.

Handle direction (iOS and Android)

  • The handle sits at the leading edge when off and slides to the trailing edge when on.
  • In LTR, the handle is on the left when off and on the right when on.
  • In RTL, the handle is on the right when off and on the left when on.

Guidelines

  • Mirror the layout of the label, icon, and switch for RTL languages.
  • Don't mirror icons that don't carry directional meaning.
  • Localize the label text. Allow room for translated strings that run longer than the English text.

Accessibility

Accessibility behaviors are built into the component to meet user preferences, including display scaling settings, TalkBack and VoiceOver compatibility, support for non-touch navigation modes, and accessible tap targets.

Additionally, teams will need to:

  • Include an adjacent label that describes what the switch controls.
  • On Android, maintain a minimum tap target area of 48dp × 48dp when laying out switches, even though their visual size is smaller. The Spectrum Android switch includes this tap target area by default in design and code. In cases where measuring or aligning to the switch's visual size matters, teams can also use Android's auto touch target expansion to measure or align the switch based on its visual size while still meeting the 48dp × 48dp minimum tap target requirement.

Perceivable

Requirement
Criterion
Level
Compliance
Non-text content
1.1.1
A
On Android, the switch is a standalone component, so the adjacent label serves as that text alternative and must be programmatically associated with the switch so TalkBack announces them as one unit. On iOS, the label is built into the list row implementation, so it's already paired with the control and read together by VoiceOver. Either way, it's the team’s responsibility to supply a label that actually describes what the switch controls; the component itself doesn't generate one.
Info and relationships
1.3.1
A
On Android, since the switch is a standalone component with no label built in, the adjacent label needs to be explicitly associated with the switch in code so TalkBack reads them as a single unit rather than as two unrelated elements. On iOS, the switch is implemented as a list row with the label included, so that structural relationship already exists as part of the row and gets read together by VoiceOver without extra work from the team.
Use of color
1.4.1
A
The Spectrum switch communicates state through more than just track color: the thumb’s position (left versus right) and the track fill both change between states, so someone with color blindness or low vision can still tell on from off without depending on hue.
Text contrast
1.4.3
AA
On Android, teams need to ensure the label text meets the 4.5:1 contrast ratio for normal text (or 3:1 for large text), since the switch is a standalone component and doesn't dictate label styling. On iOS, this is already met by the list row implementation, since the label styling is built into the component.
Non-text contrast
1.4.11
AA
The Android switch's track, handle, and boundary maintain a minimum 3:1 contrast ratio against adjacent colors in both the on and off states, so the switch's presence and current state remain visually distinguishable for people with low vision.

Operable

Requirement
Criterion
Level
Compliance
Headings and labels
2.4.6
AA
This is largely satisfied through content standards rather than implementation: labels should be a short, specific description of the setting (1 to 3 words), with any necessary clarifying detail added as supplementary text after the label rather than left for the user to infer. Labels should also stay consistent in structure and phrasing across a given view, so a group of related switches reads coherently rather than each one requiring separate interpretation.
Label in a name
2.5.3
A
On Android, since the switch is a standalone component with no built-in label, teams need to ensure the accessible name pulls from the same text as the adjacent visible label rather than a separately written string that could drift out of sync. On iOS, the label is part of the list row implementation, so the visible text and the accessible name come from the same source by default.
Target size (enhanced)
2.5.5
AAA
Android meets this requirement, since the Spectrum switch includes a 48×48dp tap target by default in both design and code, exceeding the 44×44 CSS pixel threshold. iOS does not meet this requirement.
Target size (minimum)
2.5.8
AA
Android clears this comfortably, since its 48×48dp default tap target well exceeds the minimum. On iOS, the switch control itself also exceeds the 24×24 CSS pixel threshold, meeting this criterion.

Robust

Requirement
Criterion
Level
Compliance
Name, role, value
4.1.2
A
Both Android and iOS handle this natively: TalkBack announces the switch's role and current on or off state, and VoiceOver does the same, with both updating their announcement whenever the state changes as a result of user interaction. This is distinct from the label's mere existence (covered under 1.1.1) or its association with the control(covered under 1.3.1), since 4.1.2 is specifically about the role and state being exposed and kept in sync, not about the label's presence or wording.

Resources