formsBeginneranimation
Toggle Switch
An iOS-style on/off toggle switch.
Claude prompt
Drop this into Claude Code, claude.ai, or your AI tool of choice to regenerate or remix this component from scratch.
Build an iOS-style toggle switch with Tailwind: a hidden checkbox with a styled label that becomes the visible switch. Track changes color when checked (gray → indigo); the thumb (a white circle) slides from left to right with a transition. Accessible via the underlying checkbox.
Code
html
<!--
Source: Mark Mead (HyperUI)
https://github.com/markmead/hyperui/blob/d09f638255d00e91e95f3cabea4f1d385356dd70/public/examples/application/toggles/1.html
License: MIT
Surfaced via https://vibedex-ryan-staxs-projects-fb4e0931.vercel.app/components/hyperui-app-toggle
-->
<div class="bg-white text-gray-900 min-h-screen flex items-center justify-center">
<div class="flex justify-center p-6 w-full">
<label
for="AcceptConditions"
class="relative block h-8 w-14 rounded-full bg-gray-300 transition-colors [-webkit-tap-highlight-color:transparent] has-checked:bg-green-500"
>
<input type="checkbox" id="AcceptConditions" class="peer sr-only" />
<span
class="absolute inset-y-0 start-0 m-1 size-6 rounded-full bg-white transition-[inset-inline-start] peer-checked:start-6"
></span>
</label>
</div>
</div>