role switch
Switch draft v0.1.0
Turns a setting on or off, with immediate effect.
A switch is a binary control for a setting that applies as soon as it is flipped: notifications on or off, dark mode, airplane mode. It has two values only, on and off, shown by the position of its thumb and the fill of its track. A choice that is saved later with a form, or that may be partially on, is a Checkbox.
Playground
Token inspector
Part container
Not rendered in this configuration.
-
column-gap from default
{space.8}Details
- Value
-
8px - CSS
--switch-container-column-gap- Token
switch.container.column-gap
-
row-gap from default
{space.2}Details
- Value
-
2px - CSS
--switch-container-row-gap- Token
switch.container.row-gap
Part control
Not rendered in this configuration.
-
width
smallfrom default{space.32}Details
- Value
-
32px - CSS
--switch-control-width-small- Token
switch.control.width.small- Decisions
-
width
mediumfrom default{space.40}Details
- Value
-
40px - CSS
--switch-control-width-medium- Token
switch.control.width.medium- Decisions
-
height
smallfrom default{space.20}Details
- Value
-
20px - CSS
--switch-control-height-small- Token
switch.control.height.small- Decisions
-
height
mediumfrom default{space.24}Details
- Value
-
24px - CSS
--switch-control-height-medium- Token
switch.control.height.medium- Decisions
-
border-radius from default
{corner-radius.full}Details
- Value
-
9999px - CSS
--switch-control-border-radius- Token
switch.control.border-radius- Decisions
-
border-width from default
{stroke-width.md}Details
- Value
-
1.2px - CSS
--switch-control-border-width- Token
switch.control.border-width- Decisions
-
background
defaultfrom default{global.bg.level.0.default}Details
- Resolves through
global.bg.base.neutral.1 semanticlight-switch.base.25 rawneutral.light.ash.25 raw- Value
-
#FDFDFDdark:#191919 - CSS
--switch-control-background-default- Token
switch.control.background.default- Decisions
-
background
hoverfrom default{global.bg.level.0.hover}Details
- Resolves through
global.bg.base.neutral.2 semanticlight-switch.base.50 rawneutral.light.ash.50 raw- Value
-
#F7F6F6dark:#212121 - CSS
--switch-control-background-hover- Token
switch.control.background.hover- Decisions
-
background
checkedfrom default{global.bg.accent.brand.default}Details
- Resolves through
brand.light.600 raw- Value
-
#175DD6dark:#9EE7FA - CSS
--switch-control-background-checked- Token
switch.control.background.checked- Decisions
-
background
disabledfrom default{global.bg.state.disabled.default}Details
- Value
-
#B6B4B41adark:#7676764d - CSS
--switch-control-background-disabled- Token
switch.control.background.disabled- Decisions
-
border-color
defaultfrom default{global.border.accent.neutral.default}Details
- Resolves through
light-switch.base.800 rawneutral.light.ash.800 raw- Value
-
#323031dark:#B9B7B7 - CSS
--switch-control-border-color-default- Token
switch.control.border-color.default- Decisions
-
border-color
hoverfrom default{global.border.accent.neutral.default}Details
- Resolves through
light-switch.base.800 rawneutral.light.ash.800 raw- Value
-
#323031dark:#B9B7B7 - CSS
--switch-control-border-color-hover- Token
switch.control.border-color.hover- Decisions
-
border-color
checkedfrom default{global.border.accent.brand.default}Details
- Resolves through
brand.light.700 raw- Value
-
#1148A9dark:#53D6F2 - CSS
--switch-control-border-color-checked- Token
switch.control.border-color.checked- Decisions
-
border-color
disabledfrom default{global.border.state.disabled.default}Details
- Value
-
#B6B4B466dark:#363636b2 - CSS
--switch-control-border-color-disabled- Token
switch.control.border-color.disabled- Decisions
-
outline-width
focus-visiblefrom default{focus.ring.width}Details
- Resolves through
stroke-width.lg semantic- Value
-
2.4px - CSS
--switch-control-outline-width-focus-visible- Token
switch.control.outline-width.focus-visible
-
outline-offset
focus-visiblefrom default{focus.ring.offset}Details
- Resolves through
space.4 semantic- Value
-
4px - CSS
--switch-control-outline-offset-focus-visible- Token
switch.control.outline-offset.focus-visible
-
outline-color
focus-visiblefrom default{color.focus.ring}Details
- Resolves through
brand.light.600 raw- Value
-
#175DD6dark:#9EE7FA - CSS
--switch-control-outline-color-focus-visible- Token
switch.control.outline-color.focus-visible
-
transition.duration from default
{duration.fast}Details
- Value
-
150ms - CSS
--switch-control-transition-duration- Token
switch.control.transition.duration
-
transition.easing from default
{easing.standard}Details
- Value
-
cubic-bezier(0.2, 0, 0, 1) - CSS
--switch-control-transition-easing- Token
switch.control.transition.easing
Part thumb
Not rendered in this configuration.
-
size
smallfrom default{space.12}Details
- Value
-
12px - CSS
--switch-thumb-size-small- Token
switch.thumb.size.small- Decisions
-
size
mediumfrom default{space.16}Details
- Value
-
16px - CSS
--switch-thumb-size-medium- Token
switch.thumb.size.medium- Decisions
-
margin from default
{space.2}Details
- Value
-
2px - CSS
--switch-thumb-margin- Token
switch.thumb.margin- Decisions
-
background
defaultfrom default{global.bg.accent.neutral.default}Details
- Resolves through
light-switch.base.900 rawneutral.light.ash.900 raw- Value
-
#201E1Fdark:#E8E3E4 - CSS
--switch-thumb-background-default- Token
switch.thumb.background.default- Decisions
-
background
checkedfrom default{global.icon.on-accent.brand.default}Details
- Resolves through
global.text.on-accent.brand.default semanticbrand.light.25 raw- Value
-
#FBFCFDdark:#09191D - CSS
--switch-thumb-background-checked- Token
switch.thumb.background.checked- Decisions
-
background
disabledfrom default{global.icon.state.disabled.default}Details
- Resolves through
global.text.state.disabled.default semanticlight-switch.base.500 rawneutral.light.ash.500 raw- Value
-
#8C8C8Cdark:#9D9B9Cb2 - CSS
--switch-thumb-background-disabled- Token
switch.thumb.background.disabled- Decisions
Part label
Not rendered in this configuration.
-
color
defaultfrom default{global.text.on-base.neutral.primary}Details
- Resolves through
light-switch.base.950 rawneutral.light.ash.950 raw- Value
-
#0E0D0Ddark:#D2CECF - CSS
--switch-label-color-default- Token
switch.label.color.default
-
color
disabledfrom default{global.text.state.disabled.default}Details
- Resolves through
light-switch.base.500 rawneutral.light.ash.500 raw- Value
-
#8C8C8Cdark:#9D9B9Cb2 - CSS
--switch-label-color-disabled- Token
switch.label.color.disabled
-
typography
smallfrom defaultDetails
- Value
-
Inter [object Object]/1.5 400 [object Object] - CSS
--switch-label-typography-small-font-family- Token
switch.label.typography.small- Decisions
-
typography
mediumfrom defaultDetails
- Value
-
Inter [object Object]/1.5 400 [object Object] - CSS
--switch-label-typography-medium-font-family- Token
switch.label.typography.medium- Decisions
Part description
Not rendered in this configuration.
-
color
defaultfrom default{global.text.on-base.neutral.secondary}Details
- Resolves through
light-switch.base.800 rawneutral.light.ash.800 raw- Value
-
#323031dark:#B9B7B7 - CSS
--switch-description-color-default- Token
switch.description.color.default
-
color
disabledfrom default{global.text.state.disabled.default}Details
- Resolves through
light-switch.base.500 rawneutral.light.ash.500 raw- Value
-
#8C8C8Cdark:#9D9B9Cb2 - CSS
--switch-description-color-disabled- Token
switch.description.color.disabled
-
typography
smallfrom defaultDetails
- Value
-
Inter [object Object]/1.5 400 [object Object] - CSS
--switch-description-typography-small-font-family- Token
switch.description.typography.small
-
typography
mediumfrom defaultDetails
- Value
-
Inter [object Object]/1.5 400 [object Object] - CSS
--switch-description-typography-medium-font-family- Token
switch.description.typography.medium
<div class="ds-switch" data-size="medium">
<input
type="checkbox"
role="switch"
class="ds-switch__control"
data-part="control"
id="ds-switch-17"
>
<label
class="ds-switch__label"
data-part="label"
for="ds-switch-17"
>Email notifications</label>
</div>