Skip to main content

Figma Storybook

Switch

A toggle control for enabling or disabling a binary setting with immediate effect. Use in settings panels and preference controls where the change applies without form submission. Don't use when the action needs a confirmation step.

Figma Storybook Docs

Description

What it does

Switch toggles a single setting between on and off. The change takes effect immediately — no form submission is required.

Where it appears

Settings panels, notification preferences, feature flags, and any binary control where the effect is immediate and reversible.

Why it exists

When a setting applies instantly (like a system toggle), a Switch gives users immediate, visible confirmation that their action had an effect. A checkbox in this context implies the change needs a Save button, which creates ambiguity.

Switch vs Checkbox

This distinction matters. Both look like binary controls — but they behave differently and communicate different things:

Switch Checkbox
Effect timing Immediate — change applies on toggle Deferred — change applies on form submit
Context Settings, preferences, system controls Form fields, agreements, multi-select lists
Requires confirmation? No — if yes, don't use Switch Usually yes (form submit) or no (agreement)
Label describes The setting name, not the action ("Email notifications", not "Turn on emails") The option being selected

Anatomy

PartRequired?Notes
Track Required The pill-shaped background. Changes colour to indicate on (brand/green) or off (neutral grey).
Thumb Required The circular handle that slides left (off) or right (on). Its position communicates state at a glance.
Label Required Names the setting being controlled. Must describe the setting, not the action. "Email notifications" — not "Enable email notifications".
Description Optional A supplementary line explaining what the setting does or its implications. Use when the label alone may be ambiguous.

States

State Behaviour
Off Grey track, thumb at left. The setting is disabled / inactive.
On Brand-colour track, thumb at right. The setting is enabled / active.
Disabled (off) Dim grey track, reduced opacity. The setting cannot be changed. Communicate why nearby.
Disabled (on) Dim brand track, reduced opacity. Setting is on and locked. Use when a higher-level setting forces it on.
Focus Focus ring on track. 2px solid focus ring, --op-color-focus-ring, 2px offset.
Loading Track dimmed, thumb animated. Used when toggling has a network delay. Provide an aria-busy="true" signal and restore when done.

Usage guidelines

When to use

  • A single setting can be turned on or off independently of other settings.
  • The change takes effect immediately — no Save button is involved.
  • The setting is at a system or preference level (not inside a transactional form).

When not to use

  • When the action needs confirmation before it applies — show a confirmation dialog and use a different trigger.
  • Inside a standard form that requires a Save action — use a Checkbox.
  • When the two states have names other than on/off (e.g. "Allowed" / "Blocked") — use a Radio group or Dropdown.

Do / Don't

Do

Write labels as nouns, not imperatives. "Dark mode" and "Email notifications" — not "Enable dark mode" or "Turn on emails".

Don't

Don't use a Switch for an action that can't easily be undone. If turning something off permanently deletes data, use a Modal confirmation flow instead.

Do

Provide immediate visual feedback when a Switch is toggled. If there's a server call, show a loading state — don't let the UI appear broken while waiting.

Don't

Don't add "On" / "Off" text inside the track. The thumb position already communicates state visually; text inside a small track is illegible at standard sizes.

Was this page helpful?

Updated 9 September 2026