CI / ci (push) Successful in 1m31s
Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com> Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
58 lines
1.1 KiB
CSS
58 lines
1.1 KiB
CSS
/* The button is a 44 px hit box around the 40×24 track; negative margins keep
|
||
the 40×24 layout footprint. */
|
||
.toggle {
|
||
display: inline-flex;
|
||
align-items: center;
|
||
justify-content: center;
|
||
flex: none;
|
||
width: 44px;
|
||
height: 44px;
|
||
margin: -10px -2px;
|
||
padding: 0;
|
||
border: 0;
|
||
border-radius: var(--radius-pill);
|
||
background: transparent;
|
||
cursor: pointer;
|
||
}
|
||
|
||
.toggle:disabled {
|
||
opacity: 0.45;
|
||
cursor: not-allowed;
|
||
}
|
||
|
||
.track {
|
||
position: relative;
|
||
width: 40px;
|
||
height: 24px;
|
||
border-radius: var(--radius-pill);
|
||
background: var(--color-neutral-300);
|
||
transition: background-color 150ms var(--ease-out-soft);
|
||
}
|
||
|
||
.knob {
|
||
position: absolute;
|
||
top: 3px;
|
||
left: 3px;
|
||
width: 18px;
|
||
height: 18px;
|
||
border-radius: var(--radius-pill);
|
||
background: var(--color-bg);
|
||
box-shadow: var(--shadow-sm);
|
||
transition: transform 180ms var(--ease-spring);
|
||
}
|
||
|
||
.toggle[aria-checked='true'] .track {
|
||
background: var(--color-accent-2-600);
|
||
}
|
||
|
||
.toggle[aria-checked='true'] .knob {
|
||
transform: translateX(16px);
|
||
}
|
||
|
||
@media (prefers-reduced-motion: reduce) {
|
||
.track,
|
||
.knob {
|
||
transition: none;
|
||
}
|
||
}
|