Job board

Toggle

A toggle switches the site between its light and dark themes, from the top navigation. It is a group of two Toggle - button instances, one per theme, of which exactly one is selected.

Design
Finished
Level
Ready
Audit
2 open findingsat the audit of
Last changed

Preview

Toggle, default variant as designedToggle, default variant as designed
Default variant as designed, light modedark modeOpen in Figma

Usage

Do

  • Use inside Top navigation, where it already sits on the md variants
  • Keep exactly two options, one selected

Don't

  • Use for a setting with one on/off value: use Switch
  • Use for options that are not mutually exclusive: use Checkbox
  • Confuse it with Switch, which is a single control

Behaviour

  • Selecting one Toggle - button deselects the other; the theme changes immediately

Composition

  • Contains two Toggle - button instances, with sun and moon-star supplied through their Icon swap

Accessibility

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

Dependencies in Figma

Built fromUsed byToggle - buttonToggle - buttonToggleToggleTop navigationTop navigation

Level checks

Ready · next level blocked by Warnings open

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

Anatomy

1
Every option switched on: what the component can contain, not how it is usually used
#PartShownComponent
1Toggle - button × 2AlwaysToggle - button

Implementation

What code builds differently from the drawing, and why
FigmaCodeWhy
The component, 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.

Changes on 19 Sept
ChangeTypeFigma filesCodeDetails
DescriptionDocsPatchPatch

Changes on 6 Sept
ChangeTypeFigma filesCodeDetails
Toggle: strokeRestyledMinorMinor

Changes on 1 Sept
ChangeTypeFigma filesCodeDetails
Toggle: strokeRestyledMinorMinor

Changes on 21 Aug
ChangeTypeFigma filesCodeDetails
Toggle - button: propsRestyledMinorMinor
Toggle - button#2: propsRestyledMinorMinor
ComponentAddedMinorMinor