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.
Tokens
From packages/tokens/src/components/switch.tokens.json. Path grammar: switch.<part>.<property>[.<option>][.<state>]. Every value aliases a semantic token.
No token matches.
Part container (2)
| Token | Type | Value | Resolved | CSS |
|---|---|---|---|---|
switch.container.column-gap
Between the track and the label column.
|
dimension |
{space.8}
|
8px
|
--switch-container-column-gap
|
switch.container.row-gap
Between the label and its description.
|
dimension |
{space.2}
|
2px
|
--switch-container-row-gap
|
Part control (19)
| Token | Type | Value | Resolved | CSS |
|---|---|---|---|---|
switch.control.width.small
|
dimension |
{space.32}
|
32px
|
--switch-control-width-small
|
switch.control.width.medium
|
dimension |
{space.40}
|
40px
|
--switch-control-width-medium
|
switch.control.height.small
|
dimension |
{space.20}
|
20px
|
--switch-control-height-small
|
switch.control.height.medium
|
dimension |
{space.24}
|
24px
|
--switch-control-height-medium
|
switch.control.border-radius
|
dimension |
{corner-radius.full}
|
9999px
|
--switch-control-border-radius
|
switch.control.border-width
|
dimension |
{stroke-width.md}
|
1.2px
|
--switch-control-border-width
|
switch.control.background.default
|
color |
{global.bg.level.0.default}
|
light
#FDFDFD
dark
#191919
|
--switch-control-background-default
|
switch.control.background.hover
|
color |
{global.bg.level.0.hover}
|
light
#F7F6F6
dark
#212121
|
--switch-control-background-hover
|
switch.control.background.checked
|
color |
{global.bg.accent.brand.default}
|
light
#175DD6
dark
#9EE7FA
|
--switch-control-background-checked
|
switch.control.background.disabled
|
color |
{global.bg.state.disabled.default}
|
light
#B6B4B41a
dark
#7676764d
|
--switch-control-background-disabled
|
switch.control.border-color.default
|
color |
{global.border.accent.neutral.default}
|
light
#323031
dark
#B9B7B7
|
--switch-control-border-color-default
|
switch.control.border-color.hover
|
color |
{global.border.accent.neutral.default}
|
light
#323031
dark
#B9B7B7
|
--switch-control-border-color-hover
|
switch.control.border-color.checked
|
color |
{global.border.accent.brand.default}
|
light
#1148A9
dark
#53D6F2
|
--switch-control-border-color-checked
|
switch.control.border-color.disabled
|
color |
{global.border.state.disabled.default}
|
light
#B6B4B466
dark
#363636b2
|
--switch-control-border-color-disabled
|
switch.control.outline-width.focus-visible
|
dimension |
{focus.ring.width}
|
2.4px
|
--switch-control-outline-width-focus-visible
|
switch.control.outline-offset.focus-visible
|
dimension |
{focus.ring.offset}
|
4px
|
--switch-control-outline-offset-focus-visible
|
switch.control.outline-color.focus-visible
|
color |
{color.focus.ring}
|
light
#175DD6
dark
#9EE7FA
|
--switch-control-outline-color-focus-visible
|
switch.control.transition.duration
|
duration |
{duration.fast}
|
150ms
|
--switch-control-transition-duration
|
switch.control.transition.easing
|
cubicBezier |
{easing.standard}
|
cubic-bezier(0.2, 0, 0, 1)
|
--switch-control-transition-easing
|
Part thumb (6)
| Token | Type | Value | Resolved | CSS |
|---|---|---|---|---|
switch.thumb.size.small
|
dimension |
{space.12}
|
12px
|
--switch-thumb-size-small
|
switch.thumb.size.medium
|
dimension |
{space.16}
|
16px
|
--switch-thumb-size-medium
|
switch.thumb.margin
Inset of the thumb inside the track, beyond the border.
|
dimension |
{space.2}
|
2px
|
--switch-thumb-margin
|
switch.thumb.background.default
|
color |
{global.bg.accent.neutral.default}
|
light
#201E1F
dark
#E8E3E4
|
--switch-thumb-background-default
|
switch.thumb.background.checked
|
color |
{global.icon.on-accent.brand.default}
|
light
#FBFCFD
dark
#09191D
|
--switch-thumb-background-checked
|
switch.thumb.background.disabled
|
color |
{global.icon.state.disabled.default}
|
light
#8C8C8C
dark
#9D9B9Cb2
|
--switch-thumb-background-disabled
|
Part label (4)
| Token | Type | Value | Resolved | CSS |
|---|---|---|---|---|
switch.label.color.default
|
color |
{global.text.on-base.neutral.primary}
|
light
#0E0D0D
dark
#D2CECF
|
--switch-label-color-default
|
switch.label.color.disabled
|
color |
{global.text.state.disabled.default}
|
light
#8C8C8C
dark
#9D9B9Cb2
|
--switch-label-color-disabled
|
switch.label.typography.small
|
typography |
{body.family}{body.size.sm}{body.weight.regular}{font.line-height.normal}{font.letter-spacing.normal}
|
{"fontFamily":"Inter","fontSize":{"value":14,"unit":"px"},"fontWeight":400,"lineHeight":1.5,"letterSpacing":{"value":0,"unit":"px"}}
|
--switch-label-typography-small-font-family--switch-label-typography-small-font-size--switch-label-typography-small-font-weight--switch-label-typography-small-line-height--switch-label-typography-small-letter-spacing
|
switch.label.typography.medium
|
typography |
{body.family}{body.size.md}{body.weight.regular}{font.line-height.normal}{font.letter-spacing.normal}
|
{"fontFamily":"Inter","fontSize":{"value":16,"unit":"px"},"fontWeight":400,"lineHeight":1.5,"letterSpacing":{"value":0,"unit":"px"}}
|
--switch-label-typography-medium-font-family--switch-label-typography-medium-font-size--switch-label-typography-medium-font-weight--switch-label-typography-medium-line-height--switch-label-typography-medium-letter-spacing
|
Part description (4)
| Token | Type | Value | Resolved | CSS |
|---|---|---|---|---|
switch.description.color.default
|
color |
{global.text.on-base.neutral.secondary}
|
light
#323031
dark
#B9B7B7
|
--switch-description-color-default
|
switch.description.color.disabled
|
color |
{global.text.state.disabled.default}
|
light
#8C8C8C
dark
#9D9B9Cb2
|
--switch-description-color-disabled
|
switch.description.typography.small
|
typography |
{body.family}{body.size.xs}{body.weight.regular}{font.line-height.normal}{font.letter-spacing.normal}
|
{"fontFamily":"Inter","fontSize":{"value":12,"unit":"px"},"fontWeight":400,"lineHeight":1.5,"letterSpacing":{"value":0,"unit":"px"}}
|
--switch-description-typography-small-font-family--switch-description-typography-small-font-size--switch-description-typography-small-font-weight--switch-description-typography-small-line-height--switch-description-typography-small-letter-spacing
|
switch.description.typography.medium
|
typography |
{body.family}{body.size.sm}{body.weight.regular}{font.line-height.normal}{font.letter-spacing.normal}
|
{"fontFamily":"Inter","fontSize":{"value":14,"unit":"px"},"fontWeight":400,"lineHeight":1.5,"letterSpacing":{"value":0,"unit":"px"}}
|
--switch-description-typography-medium-font-family--switch-description-typography-medium-font-size--switch-description-typography-medium-font-weight--switch-description-typography-medium-line-height--switch-description-typography-medium-letter-spacing
|