Files
MealQuest/web/src/ui/Toggle.module.css
T
dev_agent 02f1dd6491
CI / ci (push) Successful in 1m31s
Feature 05 task 2: Core UI primitives (#34)
Co-authored-by: dev_agent <dev_agent@cubecraftlabs.com>
Co-committed-by: dev_agent <dev_agent@cubecraftlabs.com>
2026-10-03 16:34:59 -04:00

58 lines
1.1 KiB
CSS
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/* 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;
}
}