mirror of
https://github.com/shoelace-style/webawesome.git
synced 2026-01-12 20:19:13 +00:00
77 lines
1.7 KiB
CSS
77 lines
1.7 KiB
CSS
/*! Switches */
|
|
.switch {
|
|
font-size: var(--switch-font-size);
|
|
}
|
|
|
|
.switch-small {
|
|
font-size: var(--switch-font-size-small);
|
|
--switch-height: var(--switch-height-small);
|
|
}
|
|
|
|
.switch-big {
|
|
font-size: var(--switch-font-size-big);
|
|
--switch-height: var(--switch-height-big);
|
|
}
|
|
|
|
.switch input {
|
|
display: none;
|
|
}
|
|
|
|
.switch input + label {
|
|
position: relative;
|
|
min-width: calc(var(--switch-height) * 2);
|
|
height: var(--switch-height);
|
|
line-height: var(--switch-height);
|
|
display: inline-block;
|
|
cursor: pointer;
|
|
outline: none;
|
|
user-select: none;
|
|
vertical-align: middle;
|
|
text-indent: calc(var(--switch-height) * 2 + .5rem);
|
|
}
|
|
|
|
.switch input + label::before,
|
|
.switch input + label::after {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: 0;
|
|
width: calc(var(--switch-height) * 2);
|
|
bottom: 0;
|
|
display: block;
|
|
}
|
|
|
|
.switch input + label::before {
|
|
right: 0;
|
|
background-color: var(--switch-bg-color);
|
|
border-radius: var(--switch-border-radius);
|
|
transition: background-color var(--switch-speed);
|
|
}
|
|
|
|
.switch input + label:after {
|
|
top: var(--switch-thumb-spacing);
|
|
left: var(--switch-thumb-spacing);
|
|
width: calc(var(--switch-height) - var(--switch-thumb-spacing) * 2);
|
|
height: calc(var(--switch-height) - var(--switch-thumb-spacing) * 2);
|
|
border-radius: var(--switch-thumb-border-radius);
|
|
background-color: var(--switch-thumb-bg-color);
|
|
transition: margin var(--switch-speed);
|
|
}
|
|
|
|
.switch input:checked + label::before {
|
|
background-color: var(--switch-bg-color-checked);
|
|
}
|
|
|
|
.switch input:checked + label::after {
|
|
margin-left: var(--switch-height);
|
|
}
|
|
|
|
.switch input:disabled + label {
|
|
opacity: .5;
|
|
cursor: not-allowed;
|
|
}
|
|
|
|
.switch + .switch {
|
|
margin-left: 1rem;
|
|
}
|