47 CSS Toggles & Switches
47 CSS toggles and switches for dark-mode theme switchers, settings and permission rows, SaaS billing toggles, and destructive-action guards — spanning iOS-style pill and Material 3 switches, neumorphic, glassmorphism, neon and brutalist styles, gooey and squash-and-stretch physics, split-flap and rotary-knob mechanics, and biometric hold-to-confirm kill switches. Scoped under .tgl-NN for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.
Related21 CSS Pricing Tables29 CSS Checkboxes24 CSS Radio Buttons47 Tailwind CSS Toggles & Switches
Course pickPartner: Zero to Mastery
Affiliate linkWant to build production-ready CSS layouts, animations and UI from scratch?
You just browsed 47 toggles. Learn the Flexbox, Grid and animation thinking behind them, so the next component starts in your head, not in a copy-paste.
Every ZTM course in one membership: $25/month, paid yearly at $299 · 30‑day money-back guarantee
The CSS Bootcamp. We may earn a commission, at no extra cost to you.
02. Dark Mode Sun / Moon Theme Switcher (opens in a new tab)
03. 3D Neumorphic Pill Toggle (opens in a new tab)
04. Gooey Liquid Morphing Switch (opens in a new tab)
05. Bouncy Elastic Physics Toggle (opens in a new tab)
06. Inner Text ON / OFF Switch (opens in a new tab)
07. SaaS Pricing Segmented Pill Toggle (opens in a new tab)
08. Haptic Mechanical Keycap Toggles (opens in a new tab)
09. Waveform Mute Toggle (opens in a new tab)
10. Timed Auto-Off Toggle (opens in a new tab)
11. Biometric Hold-to-Confirm Scan Toggle (opens in a new tab)
12. Split-Flap Departure Board Toggle (opens in a new tab)
13. Permission Stack with Live Status (opens in a new tab)
14. Material Design 3 Switch (opens in a new tab)
15. Skeuomorphic Wall Light Switch (opens in a new tab)
16. Neon Cyberpunk Toggle (opens in a new tab)
17. Brutalist Snap Toggle (opens in a new tab)
18. Day / Night Landscape Scene Switch (opens in a new tab)
19. 3D Flip Card Toggle (opens in a new tab)
20. Sliding Pill with Traveling Label (opens in a new tab)
21. Glassmorphism Frosted Toggle (opens in a new tab)
22. Skeuomorphic Rotary Knob Toggle (opens in a new tab)
23. iOS Light Mode Settings List (opens in a new tab)
24. Outline Minimal currentColor Toggle (opens in a new tab)
25. Bouncy Pebble Organic Toggle (opens in a new tab)
26. Industrial Rocker I/O Switch (opens in a new tab)
27. Accessible ARIA role=switch Toggle (opens in a new tab)
28. Haptic Keys (opens in a new tab)
29. Waveform Toggle (opens in a new tab)
30. Timed Toggle (opens in a new tab)
31. Biometric Scan (opens in a new tab)
32. Split-Flap Board (opens in a new tab)
33. Permission Stack (opens in a new tab)
34. iOS (opens in a new tab)
35. Material Design (opens in a new tab)
36. Skeuomorphic Light Switch (opens in a new tab)
37. Neon Cyber (opens in a new tab)
38. Brutalist (opens in a new tab)
39. Day / Night (opens in a new tab)
40. Flip Card (opens in a new tab)
41. Sliding Pill with Label (opens in a new tab)
42. Glassmorphism (opens in a new tab)
43. Skeuomorphic Knob (opens in a new tab)
44. iOS Light Mode (opens in a new tab)
45. Outline (opens in a new tab)
46. Bouncy Pebble (opens in a new tab)
47. Industrial Rocker (opens in a new tab)
Frequently asked questions
How do I build a pure CSS toggle switch that stays accessible?
<input type="checkbox"> and give it appearance:none so the input itself becomes the styled track — you keep native keyboard control (Space/Enter), focus management, form submission, and screen-reader semantics for free. Draw the sliding thumb as a ::before pseudo-element and move it with transform:translateX(). Add role="switch" so assistive tech announces the control as on/off rather than checked/unchecked, wire the label with <label for="…">, and expose a clear :focus-visible ring on the track. Demos 01 (iOS-style), 14 (Material Design 3), 24 (outline currentColor) and 47 (ARIA reference) all follow this contract exactly. Never use display:none to hide the checkbox — that pulls it out of the tab order and breaks keyboard operation for every visitor who does not use a mouse.What's the difference between a toggle switch and a checkbox?
<input type="checkbox">. Semantically they signal different intent: a checkbox reads as 'select this option', usually inside a form the user will submit later; a toggle switch reads as 'this setting is on or off right now', usually taking effect the moment the user activates it (dark mode, Wi-Fi, notifications, feature flags). WCAG APG lets you promote a checkbox to a switch with role="switch", at which point assistive tech announces it as on or off. Pick a switch when the change is immediate and reversible; keep a checkbox when the value is part of a bigger form that must be submitted. All 47 designs in this gallery are switch-shaped, but 40 of them use a native checkbox as the source of truth so form submission still works if you need it.Do these CSS toggle switches work without JavaScript?
:checked pseudo-class on the hidden checkbox drives every animation: the thumb slide, track colour, glow, bounce, gooey morph, background retheme (via :has()), page-level dark mode, sliding label, sun-to-moon crescent, split-flap flip and every other visual state. Four demos require JavaScript because the interaction genuinely cannot be expressed in CSS alone: Demo 08 (Haptic Mechanical Keycap) fires the Vibration API on toggle, Demo 10 (Timed Auto-Off) needs a setTimeout countdown that flips the switch back, Demo 11 (Biometric Hold-to-Confirm) needs a pointer hold duration + release-cancel gesture, and Demo 47 (Accessible ARIA switch) uses a button[role="switch"] reference implementation with focus-management for forced-colors mode. Every JS snippet ships in the code panel — no gallery globals, no hidden dependencies.Are these toggle switches accessible for keyboard and screen-reader users?
display:none), tied to a visible <label>. Keyboard users Tab to the control and toggle with Space. Every visual replacement carries a :focus-visible outline in a colour that meets WCAG 2.2 non-text contrast (3:1 against the surface). Where the semantics fit, the input carries role="switch" so assistive tech announces 'on/off' rather than 'checked/unchecked'. Every continuous animation is guarded by @media (prefers-reduced-motion: reduce) that drops long transitions and halts loops. Demo 47 is the reference ARIA implementation for forced-colors mode (Windows high-contrast) — the switch draws its state with CanvasText and Highlight system colours instead of custom hex, so the switch is legible even when the user's OS forcibly overrides the palette.Can I drop these toggle switches into React, Vue, Svelte or Astro?
class to className for React and for to htmlFor, and the switch works unchanged. Every rule is scoped under .tgl-NN, so 47 switches can coexist on one page without collision — and pasting a single switch into your own project cannot bleed into your global styles. All 47 designs are MIT-licensed for commercial use, including SaaS dashboards, marketing sites, e-commerce checkouts and mobile web apps.How do I build a SaaS pricing toggle for monthly / yearly billing?
transform. Wire the toggle to your pricing table with :has() — .pricing:has(#billing-yearly:checked) .plan-price can multiply the visible number by 0.83 (17% off), and the same selector can reveal a 'Save 2 months' badge. For a hydrated React setup, read the checkbox state into your pricing component's useState hook, but the switch itself needs zero JavaScript. Pair with schema.org PriceSpecification and Offer nodes so Google surfaces the discount in rich results. This is the highest-CPM toggle keyword in the collection — SaaS pricing pages earn $15-25 RPM in tier-1 markets.Which toggle switches match iOS, Material Design 3 and Windows Fluent design systems?
#34c759 on-state, :active stretch to 32px matching the native squash. Demo 14 (Material Design 3 Switch) follows the M3 spec — larger track, elevated thumb with a state-layer ripple on hover, icon inside the thumb when checked, oklch-based dynamic colour tokens. Demo 23 (iOS Light Mode Settings List) reproduces the full Settings-app row pattern with the switch right-aligned inside a divider list. There is no dedicated Windows Fluent switch here yet, but Demo 47 (ARIA role=switch reference) uses forced-colors system tokens and reads correctly in Windows high-contrast mode which is the accessibility contract Fluent enforces. Match the system your users expect: iOS/macOS visitors read Demo 01/23, Android/Chrome OS visitors read Demo 14.How do I ship a toggle switch for GDPR cookie consent or HIPAA disclosure?
:has(). For HIPAA-adjacent disclosure toggles (share PHI with a specific provider, opt into marketing communications), pair the switch with a visible timestamp caption that records the moment of consent — the browser cannot audit the click for you, so your backend records the state change with a server-side timestamp.Related collections
15 CSS 3D Tilt Hover Cards
15 mouse-aware 3D tilt hover cards — e-commerce product spotlight, glassmorphism parallax team card, interactive pricing tier, holographic NFT collectible, pop-out mascot, dark tech grid with border glow, media player album art, blog article preview, cyberpunk neon glow, dashboard KPI widget, minimalist real estate, flip-to-back tilt, mobile app showcase, course learning card, and a Pure CSS touch-friendly tilt. Vanilla JS writes --rx/--ry/--mx/--my; all rendering stays in CSS on the GPU.
24 CSS Animated Cards
24 hand-coded CSS animated card patterns organised by what triggers the motion, not by card style. Scroll and entrance triggers: staggered grid reveals, @starting-style mount-in, scroll-driven scale and fade on animation-timeline: view(), View Transitions API card-to-detail morphs, blur-to-sharp lazy image loading, and FLIP re-layout when a filter changes. State-change triggers: add-to-cart success morph, like and save particle burst, expand and collapse to intrinsic height with calc-size(), swipe-to-dismiss on Pointer Events, and skeleton-to-loaded crossfade. Data-driven triggers: count-up KPI metrics, SVG sparkline draw-on-enter, and progress ring fill on load. Ambient idle loops: breathing glow, floating drift, animated gradient mesh backgrounds, conic rotating borders, auto-cycling testimonial decks, and live status pulses. Plus four hover patterns where the effect is the topic itself: cursor spotlight, holographic foil glare, corner ribbon slide, and horizontal accordion expand. Every card is scoped under a .ac-NN prefix for no-collision pasting, guards prefers-reduced-motion, animates compositor-only properties, and ports unchanged to React, Vue, Svelte, Astro, Next.js and Tailwind.
22 CSS Avatars
22 hand-coded CSS avatars for chat apps, team dashboards, comment threads, account menus, and social profiles. Covers circular and squircle shapes, gradient and conic story rings, hexagon clip-path crops, online status dots, notification count badges, verified checkmarks, stacked facepiles with plus-N overflow, initials fallbacks for users without photos, broken-image recovery, avatar pickers, and a size scale system where the ring, badge, and status dot all scale from a single custom property.














































