Components · Form

Switch

A switch turns one setting on or off and applies the change at once. It is for a single binary choice, not for picking between options.

Tokens, sizes, measurements, states and requirements. Values come from the live token package and from Figma: Toggle Switch.

Design Tokens

Resolved from the live token package.

Mode · statePartTokenValue

Open points: two colors have no token: the hover On track (#71b790) and the disabled On track (rgba(36, 134, 22, 0.5)). They are written out with a comment.


Sizes

SizeTrackThumbInsetTravelLabel
Large48×24px20px2px24pxbody-md: 16/22, from 769px 17/24, 0.32px
Small48×24px20px2px24pxbody-sm: 14/20, 0.36px
X-Small32×16px12px2px16pxbody-sm: 14/20, 0.36px

The size does not change with the breakpoint; only the Large label does.


Measurements

Dimensions

AttributeLarge and SmallX-Small
Track48×24px, a pill (border-radius: 999px)32×16px
Thumb20px circle12px circle
Inset, thumb to track edge2px2px
Travel of the thumb24px16px
Gap to the label8px8px
Focus ring2px line, 2px offset2px line, 2px offset
Label line height22px mobile, 24px from 769px (Large); 20px (Small)20px

A switch has no padding or margin of its own, so there is no measurement figure: the track is the box and the thumb sits 2px inside it.

Spacing

The gap to the label as a spacing token.

PartValue
Gap, track to labelspace-8
Thumb inset2px: literal, no spacing token
Focus ring offset2px

States

Enabled, hover, focus and disabled, each off and on. Hover and focus are forced on this page; in your code they come from :hover and :focus-visible.

Mode
Breakpoint
Size
StateOffOn

Typography

PartTypeSize / line heightLetter spacingWeight
Label, Largebody-md16/22 mobile, 17/24 from 769px0.32pxRegular
Label, Small and X-Smallbody-sm14/200.36pxRegular

Breuer Condensed with ss02, ss03 and ss06. Some desktop Small and X-Small variants in Figma imply a smaller width than the 14px label: the CSS uses 14/20 for both.


Structure

Elements

ElementClassNotes
Itemform-switch-item, --sm, --xs, --darkThe label around the input and the text.
Track and thumbinput[type="checkbox"][role="switch"]appearance: none on the native input. The thumb is its ::before.
Label textspanOptional. Without it the input needs an aria-label.

Types

TypeClassUse
Largeform-switch-itemThe default.
Smallform-switch-item--smSame track, smaller label.
X-Smallform-switch-item--xsDense layouts: 32×16px track.
Darkform-switch-item--darkOn surface-100 or surface-80.

Width

An item is as wide as the track plus its label.


Motion

PropertyDurationEasing
background-color of the trackduration-fast-3ease-standard
transform of the thumbduration-fast-3ease-standard

Reduced motion (prefers-reduced-motion: reduce) turns the transition off. Figma specifies no thumb animation: this is the default for form elements in eco-motion. Open point: confirm with design.


Behavior

InputResult
Click switch or labelToggles on and off, and the change applies at once.
SpaceToggles the focused switch.
TabThe ring shows on keyboard focus only (:focus-visible), for both off and on.
MarkupA native input type="checkbox" role="switch" inside a label. Never a div or button imitation.
DisabledNot focusable. Muted track, no thumb shadow, text-disabled label.
MotionReduced motion turns the transition off.

Accessibility Requirements

TopicRequirement
ElementA native <input type="checkbox" role="switch"> in a <label>. The name, the role and the on/off state are announced.
NameA visible label, or aria-label when the setting is named by its surroundings.
FocusRing with border-focus, 2px, offset 2px, on :focus-visible (WCAG 2.4.7, 1.4.11).
ColorOn and off differ in the position of the thumb as well as the track color (WCAG 1.4.1).
EffectThe change applies at once. A switch that needs a Save button is a checkbox.
MotionReduced motion turns the transition off (WCAG 2.3.3).
DisabledNot focusable. Disabled tokens are exempt from contrast requirements.