Toggle switch
- Source
- Uiverse ↗
- Author
- PriyanshuGupta28
- Licence
- MIT
Loading…
Code
<div class="checkbox-wrapper">
<label class="toggleButton">
<input type="checkbox">
<div>
<svg viewBox="0 0 44 44">
<path transform="translate(-2.000000, -2.000000)" d="M14,24 L21,31 L39.7428882,11.5937758 C35.2809627,6.53125861 30.0333333,4 24,4 C12.95,4 4,12.95 4,24 C4,35.05 12.95,44 24,44 C35.05,44 44,35.05 44,24 C44,19.3 42.5809627,15.1645919 39.7428882,11.5937758"></path>
</svg>
</div>
</label>
</div>Prompt
Build "Toggle switch", a toggle animation. Write it as plain HTML and CSS: one container element and a stylesheet, no JavaScript unless it is essential. Technique: CSS keyframes, inline SVG. It sits on a light background, in a 16:10 frame. Respect prefers-reduced-motion with a still state, pause work when the element is off screen, and keep it accessible. Original: https://uiverse.io/PriyanshuGupta28/little-grasshopper-46 (PriyanshuGupta28, MIT).