Switch

ds-switch draws a switch around a native button: a pill two control heights wide less 4px (28 × 16px), with a white round thumb 12px across, 2px in, travelling 12px. Off it is grey; on it is a darker green whatever the page’s accent, so the white thumb stays clear in light and dark. There is one switch; there is no square one. Its measures follow the shared scale and it keeps its focus ring visible.

<ds-switch><button type="button" role="switch" aria-checked="false" aria-label="Sharing"></button></ds-switch>

The native button keeps activation for both Space and Enter, its label, ref and disabled state, and never submits a form. Product state sets its aria-checked value after a change is accepted.

React products import Switch from DS1/react/choice. It takes checked and onCheckedChange; canceling its onClick prevents the change request. Disabled and busy state are distinct: aria-busy announces work, while disabled blocks activation when the product requires it. Use aria-label when the switch has no visible text.

<Switch aria-label="Sharing" checked={sharing} onCheckedChange={setSharing} disabled={saving} />

On Apple it is .toggleStyle(.ds1Switch), on Android DS1Switch, the same pill.

Use compact monochrome for a dense control panel: a 24 × 12px pill with an 8px thumb and 12px travel, inside a 40 × 20px native button. All measures follow the shared scale. On uses the text colour with a paper-colour thumb; off uses a quiet grey track. Focus and disabled states remain visible. Normal switches retain their 32 × 16px green face.

<ds-switch compact monochrome><button type="button" role="switch" aria-checked="true" aria-label="Spacing"></button></ds-switch>

The React adapter accepts the same compact and monochrome boolean options. Native platform switches retain their standard size and appearance.

Reading preferences

Switches remain aligned at the ends of their label rows.

Turn a setting on or off

Click or press Space to change the local setting. No settings are saved.

--ds-switch-size (its height: two heights wide less 4px, the thumb and its travel following), --ds-switch-track-on and --ds-switch-track-off. They are unset by default: each face reads its token first and falls back to its own measure, so a page that sets none draws exactly as before. Lengths are unscaled pixels, multiplied by the surface scale (--ds-sf) where the component is drawn. Design system 1’s component editor sets them live for every page that links the base sheet; a page can also set them itself. The compact face keeps its own measures.