File: /var/www/design.system/src/molecules/Inputs/Switch/Switch.module.scss
.root {
width: min-content;
min-width: 340px;
cursor: default;
position: relative;
&.disabled {
.label {
color: var(--textDisabledPrimary);
}
.description {
color: var(--textDisabledSecondary);
}
.switch::after {
background-color: var(--iconDisabledPrimary);
}
input:checked + .wrapper {
.switch {
background-color: var(--backgroundDisabledPrimary);
}
}
input:checked + .wrapper {
.switch::after {
background-color: var(--iconDisabledPrimary);
}
}
}
}
.input {
width: 40px;
height: 28px;
position: absolute;
opacity: 0;
top: 0;
right: 0;
margin: 0;
z-index: 1;
}
.wrapper {
display: flex;
flex-direction: row-reverse;
justify-content: space-between;
height: 22px;
label {
flex-grow: 1;
}
&:hover {
.switch {
background-color: var(--backgroundBrandTertiaryHover);
}
.input:checked + .wrapper {
.switch {
background-color: var(--backgroundBrandPrimaryHover);
}
}
.input:checked + .switch::after {
background-color: var(--iconBrandOnBrandPrimary);
}
}
}
.switch {
width: 40px;
height: 24px;
background-color: var(--backgroundBrandTertiary);
border-radius: 24px;
flex-shrink: 0;
position: relative;
transition: background 0.3s;
}
.switch::after {
content: '';
position: absolute;
top: 3px;
left: 3px;
width: 18px;
height: 18px;
background-color: var(--iconBrandPrimary);
border-radius: var(--radiusFull);
transition: transform 0.3s;
}
.input:checked + .wrapper {
.switch {
background-color: var(--backgroundBrandPrimary);
&::after {
transform: translateX(16px);
background-color: var(--iconBrandOnBrandPrimary);
}
}
&:hover {
.switch {
background-color: var(--backgroundBrandPrimaryHover);
}
}
}
.label {
color: var(--textDefaultPrimary);
}
.description {
color: var(--textDefaultSecondary);
}