esc
  • WorkflowsPages
  • Case studiesPages
  • Machine Learning FoundationsLearn
  • AI EngineeringLearn
  • AI Guardrails & Red TeamingLearn
  • UI/UXLearn
  • Design SystemsLearn
  • Production System DesignLearn
  • Book a callContact
  • Download ResumeContact
Let’s talk

I’ll build the agent for it.

Input Switch: The On/Off Control That Applies a Setting the Moment It Flips

Learn when a switch fits better than a checkbox, how to design its parts and states, and how to make it usable with a keyboard and a screen reader.

In short

A switch is an on/off control that applies a setting the moment it flips, so it suits instant settings better than a checkbox does.

13 min readFree

What You Will Learn

An input switch is a small control that turns one setting on or off. When a person flips it, the change happens right away. You do not need a Save button.

In this lesson you will learn when a switch is the right control, how to plan its parts and states, and how to make it work for people who use a keyboard or a screen reader. You will also walk through a Wi-Fi switch step by step, so you can see the ideas working on a real screen.

Key words

Input switch
A toggle control with two states, usually on and off, that applies its change at once. In a design system it is a reusable part with set states, labels, and behavior.
Toggle
Another word for a control that flips between two states.
Setting
One choice the product remembers, such as Wi-Fi on or off.
Checkbox
A small square a person ticks. The change usually waits until the person presses a button such as Save or Submit.
Track
The bar the switch sits in.
Thumb
The round knob that slides from one end of the track to the other.
Label
The words beside the control that say what it controls.
State
The condition a control is in at a moment, such as on, off, focused, or disabled.
Focus
The visible mark that shows which control will respond to the keyboard.
Role
A name that tells assistive tools, such as screen readers, what kind of control something is.
Contrast
How different two colors are in lightness, such as a switch edge and the page behind it.
Disabled
Shown on the screen but unavailable to change.

Switch or Checkbox?

The most common mistake is choosing a control by how it looks. A switch and a checkbox both offer on and off, but they tell the user different things. A switch says the change is live now. A checkbox says the choice is held until the user confirms it.

  • Switch: immediate effect

    Use a switch for one setting that takes effect the moment it flips. Wi-Fi on or off is the classic case.

  • Checkbox: deferred effect

    Use a checkbox when the choice must be reviewed or confirmed first.

  • Many options: not a switch

    A switch handles one setting. When a person must pick among several options, a switch is the wrong tool. Other controls handle lists of choices, and later lessons cover them.

Designers often describe the difference as a question of timing, not looks. The design question is not “Which box looks nicer?” It is “Will the user expect this to change now?”

Checkboxes can also show a third, partial state when some child options are chosen and others are not. A switch cannot show that middle state, which is one more reason to keep switches for simple yes-or-no settings.

The Save test below gives you a fast way to decide.

The Save Test

  1. 1

    Name the setting

    Write one sentence that says what the control changes. If you cannot write it, the control is not ready.

  2. 2

    Ask about timing

    Does the change need a button to take effect? If yes, the user expects a confirmation step, so a checkbox fits better.

  3. 3

    Ask about reversibility

    Can the user flip the setting back with no harm? Switches suit changes that are easy to undo. Destructive or one-time actions need a button and a confirmation step instead.

  4. 4

    Check the rest of the page

    Look for a Save or Submit button nearby. A switch on a page that also has a Save button gives mixed signals.

Tip

If the user will expect a Save step, use a checkbox. If the user will expect the change to happen as soon as they touch it, use a switch.

What are the anatomy and states of a switch?

Before you write a switch into a design system, name its parts. Teams that use the same names save time when they talk about a fix. A switch has three main visible parts.

  • Track

    The bar the switch sits in. Its fill or color is a first clue to the state, and it should stay readable in both positions.

  • Thumb

    The round knob that slides. When the switch is toggled, the thumb moves to the opposite end of the track. Many systems allow a small icon inside the thumb to repeat the state, such as a check for on and a cross for off.

  • Label

    The words placed beside the switch. Material UI guidance says the controlled option and its state should be clear from an inline label.

Each part can look different in each state. A solid design system shows every state on purpose, so builders do not guess.

Switch States to Document

  • Default

    The resting look before anyone touches it. A switch is never empty, so it must always show a clear on or off starting point.

  • Hover

    The look when a mouse pointer rests on the switch. A helpful pattern is to make the hover look match the focus look, so users see that the control is ready to act.

  • Focus

    The visible ring or outline that appears when a keyboard user reaches the switch. This state is covered in more detail in the accessibility section.

  • Pressed

    The look for the moment someone pushes the switch. A short change in the thumb or track makes the press feel real before the state settles.

  • Disabled

    The switch is shown but cannot be changed. It should look clearly muted, yet still be readable, so users understand why they cannot act.

  • On and off

    The two resting positions. Each one should show its meaning through the thumb position, the track fill, and, where useful, a word or icon. Not through color alone.

Label Wording

A switch label should describe the setting, not the action. The label is a name for the thing being controlled, such as Wi-Fi, Dark mode, or Show notifications. The switch itself shows whether it is on or off, so the label does not need words like Turn on or Enable.

Designers who write labels as commands, such as Save changes or Click to share, make the control harder to read. Guidance on option toggles also says the control should show its current state. The label names the setting; the switch shows the state.

Avoid putting words inside the track. If on and off words are needed, place them beside the track, and use them the same way in every switch.

Tip

Read the label out loud, then add the words on or off after it. If the sentence still makes sense, the label names the setting. If it reads like a command, rewrite it.

How should a switch behave for accessibility?

A switch must work for people who cannot use a mouse, cannot see small color changes, or use a screen reader. Designers do not have to invent these rules. Web accessibility guidance from the W3C describes how a switch should behave.

  • Role: announced as a switch

    The W3C pattern gives a custom switch the role named switch. A screen reader then announces it as a switch rather than as a generic element.

  • State: on or off, stated in words

    The state must be shared in a way that tools can read. The W3C pattern uses a true or false value that must match the on or off position on screen. The two must never disagree.

  • Keyboard: Space flips it

    When focus is on the switch, pressing Space changes its state. Enter also toggles the switch in the same pattern. The user reaches the switch with the Tab key like any other control.

  • Focus and color

    A visible focus ring tells keyboard users where they are. The on and off states can be shown with text equivalents, and the switch can have visible borders against the page.

Keyboard and Focus

  1. 1

    Reach the switch

    The user presses Tab until the focus ring lands on the switch and its label.

  2. 2

    Check the focus ring

    The ring must be easy to see against the page. If focus is hard to spot, the user cannot tell where they are.

  3. 3

    Press Space

    The state changes at once. The thumb slides and the change takes effect right away.

  4. 4

    Listen to the announcement

    A screen reader should say the label and the new state, such as on or off, plus the word switch. Example pages built by the ARIA community show this pattern for notification preferences.

  5. 5

    Move on

    The user presses Tab to leave the switch. Nothing else should change without the user asking for it.

Color Is Not Enough

Many people cannot tell two colors apart. So a design should show the state in at least two ways. A readable Android guide notes that the thumb can carry an optional icon, such as a checkmark, that shows the selection. The thumb also moves to a different end of the track. Position, icon, and color then all agree.

Touch size matters too. A Material 3 developer guide for Android recommends a minimum touch target of 48 dp, so a finger can hit the switch without missing.

Tip

Test the switch with three checks: can you reach it with Tab, flip it with Space, and tell its state without seeing color?

Worked Example: A Wi-Fi Switch

Phone Settings screens are a good model for an input switch. Each row often holds one setting, a clear label, and a switch that takes effect at once. Wi-Fi is one of the clearest cases. Here is how the design works, step by step, using the parts and rules you have just read.

  1. 1

    Read the label

    The row says Wi-Fi. It names the setting, not an action. The person knows what the switch controls before touching it.

  2. 2

    Read the state

    The thumb sits at one end of the track, and the track shows its fill. The position and fill tell the user whether Wi-Fi is on or off, so the state does not depend on color alone.

  3. 3

    Flip it

    The person taps the switch. The thumb slides to the other end of the track in the same moment. Wi-Fi turns on or off right away.

  4. 4

    Notice there is no Save button

    The row has no Save or Apply button. This is the signal that the change is immediate. If the screen asked for a button, a checkbox would be the better control.

  5. 5

    Flip it back

    The person can turn Wi-Fi off again with no penalty. A reversible setting like this fits a switch well.

  6. 6

    Use the keyboard path

    A keyboard user tabs to the row, sees a focus ring, and presses Space. A screen reader announces the label, the on or off state, and that it is a switch.

This one row shows the whole lesson. The label names the setting, the track and thumb show the state, the change is instant, and the behavior works for people who do not use a mouse.

Tip

When you document a switch in a design system, show one worked row like this. It shows the label, both states, the instant effect, and the absence of a Save button in one picture.

How do you document the switch in a design system?

A design system switch is useful only when every team builds it the same way. So the switch needs a written page that explains its parts, states, labels, and behavior. The rules below are the core of that page. Other lessons cover how to write guidelines in general.

  • Names

    Give every part one name that all teams use, such as track, thumb, and label. This keeps design files and code talking about the same thing.

  • States

    Show all six states with clear visuals: default, hover, focus, pressed, disabled, and on and off. Missing states lead to guesses later.

  • Label rules

    Ask writers to name the setting, not the action, and to keep on and off words beside the track rather than inside it.

  • Behavior

    State that the change applies immediately, that Space flips the switch, and that the focus ring must always be visible.

  • Do and do not

    Do use a switch for one reversible setting with an instant effect. Do not use it in a form that has a Save button, do not use it where a button should be, and do not use it for destructive or one-time actions.

Tip

Some teams add small variations, such as a switch with an icon in the thumb. Add a variation only when a real product need appears, so the system stays small and clear.

Check Your Understanding

Try these short scenarios. Each one needs the ideas from this lesson to answer well.

Quick check

A settings page has a “Subscribe to newsletter” option. It only takes effect after the user clicks “Save changes.” Which control fits, and why?

Quick check

A team designs a privacy row. Tapping the switch should turn location sharing on or off right away. Which label follows the guidance best?

Quick check

A dark mode switch has a faint focus outline. On and off differ only by a light and dark shade of the same color. Which two fixes match the guidance?

Key Takeaways

  • Pick by timing

    A switch applies one reversible setting right away. A checkbox waits for a confirmation step.

  • Name the setting

    Labels describe the setting. The switch shows the state, so the label does not need command words.

  • Design for every user

    Support role, Space, a visible focus ring, enough contrast, and a state that does not depend on color alone.

Document every part and state in your design system, so every team builds the same switch. Next, practice the Save test on a settings page you know.

Sources

How is this lesson?

Last updated on 17 November 2026

Learn with me

Every lesson is free. I add new ones as I learn. Have a question, or want help with your own work? Book a short call.