Skip to content

Switch Component

A switch component for toggling between on and off states.

Example

Basic Usage
html
<tap-switch></tap-switch>
Checked State
html
<tap-switch checked></tap-switch>
Disabled State
html
<tap-switch disabled></tap-switch>

Properties

NameTypeDefaultDescription
checkedbooleanundefinedWhether the switch is in the checked (on) state.
disabledbooleanundefinedWhether the switch is disabled and non-interactive.
valuestringundefinedThe value associated with the switch when it is checked.

CSS Parts

NameDescription
switchThe container that wraps the switch component.
inputThe input element that represents the switch's toggle functionality.
sliderThe slider element that visually represents the switch's state.

Check this link to learn how to use CSS parts for Switch Component.

CSS Properties

TokenDefaultDescription
--tap-switch-background-color--tap-sys-color-surface-tertiaryThe background color of the switch.
--tap-switch-checked-background-color--tap-sys-color-surface-inverse-primaryThe background color of the checked switch.
--tap-switch-disabled-background-colorvar(--tap-sys-color-surface-disabled)The background color of the disabled switch.