Job board

Switch

A switch turns a setting on or off, taking effect immediately — "Show expired" on a company page. Selected carries the value.

Design
Finished
Level
Stable
Audit
Nothing openat the audit of
Last changed

Preview

Switch, default variant as designedSwitch, default variant as designed
Default variant as designed, light modedark modeOpen in Figma

Usage

Do

  • Use for a setting that applies the moment it changes, with no save step
  • Pair it with a label owned by the surrounding row; the switch has none of its own
  • Use for exactly two states, on and off

Don't

  • Use inside a form that is submitted: use Checkbox
  • Use where the change needs confirmation
  • Confuse it with switch on the ❖ Graphic page, which is a decorative illustration

Behaviour

  • Selected moves the Knob and switches the track colour
  • State (Focus, Hover, Press) and Disabled are managed by code and not applied in static designs

Accessibility

Follows the WAI-ARIA switch pattern: roles, keyboard and focus behaviour.

Level checks

Stable

The ladder's checks for Switch
CheckLevelResult
AuditedReadyPasses
No errors openReadyPasses
Has a descriptionReadyPasses
Usage and Don't writtenReadyChecked at the next audit
Every layer namedReadyPasses
In codeReadyPasses
No warnings openStablePasses
Code gen notes writtenStableChecked at the next audit
Auto layout throughoutStableChecked at the next audit
Matches the designStablePasses

Properties

Switch: each property, its type, values and default
PropertyTypeValuesDefault
SelectedVariant
FalseTrue
False
DisabledVariant
FalseTrue
False
StateVariant
RestFocusHoverPress
Rest

States

StateSet by
FocusInteraction
HoverInteraction
PressInteraction
SelectedThe Selected property
DisabledThe Disabled property

Implementation

What code builds differently from the drawing, and why
FigmaCodeWhy
Content, inside strokeborder with box-sizing: border-box and padding less the stroke, or box-shadow: inset 0 0 0 <width>Figma's inside stroke takes no space; a border does.
Focus ring, a layer 4px outside the boxoutline on :focus-visible, outline-offset 4px less the ring's widthFigma has no focus state, so it draws the ring as a layer; in code it is not an element.
Selectedaria-selected, aria-pressed or checkedThe element's own selection state, by what the element is, so assistive technology announces it.
Disableddisabled, or aria-disabled where it must stay focusableThe element's own state: the browser keeps it out of the tab order and out of form submission.
State: Focus, Hover, Press:focus-visible, :hover, :activePseudo-classes the browser sets, so a template cannot claim a state the control is not in.

Changes on 19 Sept
ChangeTypeFigma filesCodeDetails
DescriptionDocsPatchPatch

Changes on 6 Sept
ChangeTypeFigma filesCodeDetails
Content: strokeRestyledMinorMinor

Changes on 1 Sept
ChangeTypeFigma filesCodeDetails
Content: strokeRestyledMinorMinor

Changes on 21 Aug
ChangeTypeFigma filesCodeDetails
Its values movedRestyledMinorMinor
ComponentAddedMinorMinor