Skip to main content
Cayuse Design System Lato · 4pt grid · WCAG 2.1 AA

Components · Inputs

Toggle

An on/off switch that takes effect immediately. If the change only applies after the user presses Save, it should be a checkbox instead.

Figma source: Toggle ↗

Examples

Toggles — these are live
html
<label class="cds-toggle">
  <input class="cds-toggle__control" type="checkbox" role="switch" checked>
  Email me when the status changes
</label>
States
Off
On
Disabled

Figma properties

PropertyValuesNotes
ToggleOn · OffThe value.
StateDefault · Focused · DisabledRuntime state.
The disabled state loses the on/off value

--toggle-disabled-background is a single grey, so a disabled toggle looks the same whether it is on or off. A user who cannot change a setting still needs to know what it is currently set to.

Suggested fix: keep the track position and dim it, rather than replacing the fill — the thumb should stay on the side that reflects the value.

Usage

When to use it

  • Use for a setting that takes effect the instant it is switched.
  • Label it with the thing being turned on, phrased positively.
  • Show the result of the change immediately, so the toggle is self-evidently doing something.

When not to use it

  • Do not use inside a form that is saved with a button — use a Checkbox, which reads as “this will apply when I save”.
  • Do not use for choosing between two named alternatives — that is a Switch.
  • Do not add On/Off text beside the control; the position is the state, and the label should name the setting.
  • Do not use for anything destructive or hard to reverse without a confirmation step.
ControlUse whenApplies
ToggleA setting is turned on or offImmediately
CheckboxA yes/no answer within a formOn save
SwitchChoosing between two named alternativesImmediately

Accessibility

  • Use <input type="checkbox" role="switch">. The native checkbox gives keyboard operation and state for free; role="switch" makes it announce as “on”/“off” rather than “checked”.
  • The label names the setting. The control announces the state — do not duplicate the state in the label text.
  • Space toggles. Do not bind Enter to a toggle inside a form; it submits.
  • If switching triggers a visible change elsewhere, announce it politely.

Tokens consumed

TokenApplied toResolves to
--toggle-on-backgroundTrack when on--primary-brand-color → #0076b6
--toggle-off-backgroundTrack when off--color-gray-500 → #5e5e5e
--toggle-on-indicator / --toggle-off-indicatorThumb--color-white
--toggle-disabled-backgroundTrack when disabled--disabled-text → #888c8c