When to use
- To turn one setting on or off when the change takes effect at once, such as pausing a sync job.
When not to use
- For a choice saved later with a form’s Save button. Use a checkbox.
- For more than two options. Use radio buttons or a segmented control.
Colours
ON is neutral, not success. OFF is available, not disabled.
- ON uses the colours of the primary button: the
background.neutral.boldtrack with the inverse thumb and label. Never success green or brand yellow, because a switch shows a setting, not the result of an operation. - OFF has the
background.neutraltrack, a thumb in the icon colour and aborder.boldedge, so people can see it is a control they can use. Don’t give it the disabled colours. - Each state has its own thumb colour, paired with its track, and a label colour for On and Off text when a product shows it inside a wider track. Don’t put one white thumb on both tracks: on the light OFF track it disappears.
States
All colour names below start with color..
| State | OFF | ON | Other cue |
|---|---|---|---|
| Normal | Track background.neutral; thumb icon; label text; edge border.bold |
Track and edge background.neutral.bold; thumb icon.inverse; label text.inverse |
Thumb position and aria-checked |
| Hover | Track .hover; same thumb, label and edge |
Track and edge .hover; same thumb and label |
The checked state doesn’t change |
| Pressed | Track .pressed; same thumb and label; edge graphite 10 |
Track and edge .pressed; same thumb and label |
The OFF edge keeps 3:1 against its pressed track |
| Focus | Same colours as normal | Same colours as normal | The focus ring switch.focus-ring, 2 px with a 2 px gap |
| Loading | Same colours as normal OFF | Same colours as normal ON | A spinner in switch.{off,on}.loading-icon; the switch can’t be changed until the save ends |
| Disabled | The disabled colours for track, thumb, label and edge | The same disabled colours; the thumb stays in the ON position | No transparency |
ON works like the primary button: its track is graphite 12, the last step, so hover moves one step back (graphite 11) and pressed two steps back (graphite 10). The tokens already do this, in light and in dark.
Size
The track is 36 × 20 px (switch.size.track.width, switch.size.track.height) with a 16 px thumb (switch.size.thumb), and both use radius.full. The area that responds to a click is at least 24 × 24 px, and 44 × 44 px on touch screens.
Tokens
| Token | Value | Description |
|---|---|---|
--bh-switch-size-track-height | 1.25rem | 20 px. Height of the switch track. |
--bh-switch-size-track-width | 2.25rem | 36 px. Width of the switch track. |
--bh-switch-size-thumb | 1rem | 16 px. Diameter of the switch knob. |
--bh-switch-focus-ring | {color.border.focus}#005195Dark: #6bb3fa | Keyboard-visible ring for either checked state; keep the existing focused border width and focus offset. Does not replace the ON/OFF track, thumb or label. |
--bh-switch-off-track | {color.background.neutral}#f1f1f0Dark: #282827 | OFF track, normal. Neutral boolean-state fill, never business-success green. |
--bh-switch-off-track-hover | {color.background.neutral.hover}#e5e5e4Dark: #31302f | OFF track, hover. Neutral boolean-state fill, never business-success green. |
--bh-switch-off-track-pressed | {color.background.neutral.pressed}#d9d9d8Dark: #393937 | OFF track, pressed. Neutral boolean-state fill, never business-success green. |
--bh-switch-off-track-focus | {switch.off.track}#f1f1f0Dark: #282827 | OFF track, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-off-track-loading | {switch.off.track}#f1f1f0Dark: #282827 | OFF track, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-off-track-disabled | {color.background.disabled}#f1f1f0Dark: #282827 | OFF track, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-off-thumb | {color.icon}#42413fDark: #cdccc9 | OFF thumb, normal. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-off-thumb-hover | {color.icon}#42413fDark: #cdccc9 | OFF thumb, hover. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-off-thumb-pressed | {color.icon}#42413fDark: #cdccc9 | OFF thumb, pressed. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-off-thumb-focus | {switch.off.thumb}#42413fDark: #cdccc9 | OFF thumb, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-off-thumb-loading | {switch.off.thumb}#42413fDark: #cdccc9 | OFF thumb, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-off-thumb-disabled | {color.icon.disabled}#949390Dark: #6b6a67 | OFF thumb, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-off-label | {color.text}#2b2a28Dark: #eeeeed | OFF label, normal. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-off-label-hover | {color.text}#2b2a28Dark: #eeeeed | OFF label, hover. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-off-label-pressed | {color.text}#2b2a28Dark: #eeeeed | OFF label, pressed. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-off-label-focus | {switch.off.label}#2b2a28Dark: #eeeeed | OFF label, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-off-label-loading | {switch.off.label}#2b2a28Dark: #eeeeed | OFF label, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-off-label-disabled | {color.text.disabled}#949390Dark: #6b6a67 | OFF label, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-off-border | {color.border.bold}#7b7976Dark: #878682 | OFF border, normal. Meaningful boundary without changing native geometry. |
--bh-switch-off-border-hover | {color.border.bold}#7b7976Dark: #878682 | OFF border, hover. Meaningful boundary without changing native geometry. |
--bh-switch-off-border-pressed | {color.graphite.10}#5f5e5bDark: #a8a6a3 | OFF border, pressed. Graphite 10 keeps at least 3:1 against the pressed neutral track in both themes without changing native geometry. |
--bh-switch-off-border-focus | {switch.off.border}#7b7976Dark: #878682 | OFF border, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-off-border-loading | {switch.off.border}#7b7976Dark: #878682 | OFF border, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-off-border-disabled | {color.border.disabled}#bdbcbbDark: #454443 | OFF border, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-off-loading-icon | {color.icon.inverse}#fdfdfcDark: #181717 | Spinner foreground inside the OFF thumb, paired with switch.off.thumb.loading. Keep the native spinning indicator and blocked callback behavior. |
--bh-switch-on-track | {color.background.neutral.bold}#2b2a28Dark: #eeeeed | ON track, normal. Neutral boolean-state fill, never business-success green. |
--bh-switch-on-track-hover | {color.background.neutral.bold.hover}#42413fDark: #cdccc9 | ON track, hover. Neutral boolean-state fill, never business-success green. |
--bh-switch-on-track-pressed | {color.background.neutral.bold.pressed}#5f5e5bDark: #a8a6a3 | ON track, pressed. Neutral boolean-state fill, never business-success green. |
--bh-switch-on-track-focus | {switch.on.track}#2b2a28Dark: #eeeeed | ON track, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-on-track-loading | {switch.on.track}#2b2a28Dark: #eeeeed | ON track, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-on-track-disabled | {color.background.disabled}#f1f1f0Dark: #282827 | ON track, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-on-thumb | {color.icon.inverse}#fdfdfcDark: #181717 | ON thumb, normal. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-on-thumb-hover | {color.icon.inverse}#fdfdfcDark: #181717 | ON thumb, hover. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-on-thumb-pressed | {color.icon.inverse}#fdfdfcDark: #181717 | ON thumb, pressed. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-on-thumb-focus | {switch.on.thumb}#fdfdfcDark: #181717 | ON thumb, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-on-thumb-loading | {switch.on.thumb}#fdfdfcDark: #181717 | ON thumb, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-on-thumb-disabled | {color.icon.disabled}#949390Dark: #6b6a67 | ON thumb, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-on-label | {color.text.inverse}#fdfdfcDark: #181717 | ON label, normal. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-on-label-hover | {color.text.inverse}#fdfdfcDark: #181717 | ON label, hover. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-on-label-pressed | {color.text.inverse}#fdfdfcDark: #181717 | ON label, pressed. Paired foreground against this checked-state track; never reuse the opposite checked-state foreground. |
--bh-switch-on-label-focus | {switch.on.label}#fdfdfcDark: #181717 | ON label, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-on-label-loading | {switch.on.label}#fdfdfcDark: #181717 | ON label, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-on-label-disabled | {color.text.disabled}#949390Dark: #6b6a67 | ON label, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-on-border | {color.background.neutral.bold}#2b2a28Dark: #eeeeed | ON border, normal. Meaningful boundary without changing native geometry. |
--bh-switch-on-border-hover | {color.background.neutral.bold.hover}#42413fDark: #cdccc9 | ON border, hover. Meaningful boundary without changing native geometry. |
--bh-switch-on-border-pressed | {color.background.neutral.bold.pressed}#5f5e5bDark: #a8a6a3 | ON border, pressed. Meaningful boundary without changing native geometry. |
--bh-switch-on-border-focus | {switch.on.border}#2b2a28Dark: #eeeeed | ON border, focus. Normal pair under the independent keyboard focus ring; pointer hover/pressed feedback may coexist with the ring. |
--bh-switch-on-border-loading | {switch.on.border}#2b2a28Dark: #eeeeed | ON border, loading. Preserve the normal checked-state pair while the native spinner signals pending work; native interaction stays blocked. |
--bh-switch-on-border-disabled | {color.border.disabled}#bdbcbbDark: #454443 | ON border, disabled. Opaque disabled role; checked position and visible labels remain. No opacity dimming. |
--bh-switch-on-loading-icon | {color.icon}#42413fDark: #cdccc9 | Spinner foreground inside the ON thumb, paired with switch.on.thumb.loading. Keep the native spinning indicator and blocked callback behavior. |