toggle
Switch
ECT approvedUpdated May 21, 2026
Description
- A switch immediately turns something on or off without a further save. For example, a software feature or app setting.
- It lets a user easily toggle between 2 states.
Anatomy
Anatomy
Size
Available in M size and L size.
States
Component-specific states
Note: the switch component has no error state because it always has a valid value (on or off).
Default
Processing
Variations
Vertical label
Inline label
Color mode
Light
Dark
Dos and don'ts
Do
Do
Do
Resources
Industry guidance from Luke Wroblewski
Technical example
Switch component implemented in Carbon.
Other names
Toggle
Use case
Users should be able to:
- Navigate to a switch using assistive technology.
- Toggle the switch on and off.
- Receive feedback on the state of the switch.
Interactions
- Toggling a switch causes content to change or settings to be applied immediately.
- Switches do not require ‘save’ or ‘submit’ buttons for changes to happen.
- Switches should only be used when choosing between two opposing states, usually on/off states.
Keyboard interactions
- Tab. Moves focus from the previous interactive element on the page to the switch.
- Enter or Space. Toggles the switch between on and off.
Design considerations
- A switch should always have a clear, visible label describing its purpose.
- Use clear visual indicators for on and off states, including color, text, and position of icons.
- Avoid using only visual indicators to convey on and off states. Provide text to help convey meaning.
- Make sure that switches are large enough for touch and mouse interaction.
Development considerations
- The switch label should be provided using a label attribute, with a for attribute pointing to the id of the switch element.
- There is no native switch element in HTML, so switches need to use role=switch to accurately convey information to screen reader users.
- The switch should be a checkbox, with a role=”switch”so the checked and unchecked behaviour is inherited and announced to screen reader users.
- Some browsers may not support ARIA roles, so do not use generic elements such as div to create switches.
| Date | Changes |
|---|---|
| October 2025 | In States section removed error state and added note to callout.Added Color mode section.In Variations removed no-label and replaced with vertical-label. Removed marketing example.In Dos and Don'ts removed disabled & read-only example. Guidance on states is available in General specs |
| September 2025 | Removed marketing theme from variations. |
| August 2025 | Updated guidance on the accessibility tab. |
| May 2025 | Removed '*' from the label |
| September 2024 | New version created. Previous version archived in the frozen Web design system. |