47 hand-coded CSS toggle switches you can copy-paste into any project. The gallery covers iOS-style, Material Design 3, dark-mode sun/moon, neumorphic pill, gooey liquid morph, bouncy physics, inner ON/OFF text, SaaS pricing pill, haptic keycaps, waveform mute, timed auto-off, biometric hold-to-confirm, split-flap board, permission stack, skeuomorphic light switch, rotary knob, neon cyberpunk, brutalist, day/night landscape, 3D flip card, glassmorphism, industrial rocker, and an ARIA role="switch" reference implementation for forced-colors mode. Every switch is a real <input type="checkbox"> under the hood — keyboard-operable with Space, visible focus ring, honest state semantics. Scoped under .tgl-NN for no-collision pasting, prefers-reduced-motion guarded, framework-agnostic.

43 pure CSS4 light JSPublished 27 new designs · Updated on

Related21 CSS Pricing Tables29 CSS Checkboxes24 CSS Radio Buttons

Minimal iOS-Style Toggle Switch — preview
01 / 47Pure CSSNEW

Minimal iOS-Style Toggle Switch

The most searched toggle pattern on earth: a fluid, platform-agnostic iOS-style switch built entirely from a styled checkbox. The track sweeps from neutral gray to Apple green while a crisp white thumb glides across — and pressing it stretches the thumb exactly like the native control.

Published

Dark Mode Sun / Moon Theme Switcher — preview
02 / 47Pure CSSNEW

Dark Mode Sun / Moon Theme Switcher

The classic 'day night switch': the sliding thumb is a glowing sun that morphs into a crescent moon as the track deepens from daylight blue to midnight navy — stars fade in, a cloud drifts out, and the entire panel re-themes via :has(). Zero JavaScript.

Published

3D Neumorphic Pill Toggle — preview
03 / 47Pure CSSNEW

3D Neumorphic Pill Toggle

A tactile soft-UI switch for modern immersive dashboards: the track is carved INTO the surface with inset shadows while the knob extrudes OUT of it — and pressing gives a physical push-down before the knob glides across and an accent ring wakes up.

Published

Gooey Liquid Morphing Switch — preview
04 / 47Pure CSSNEW

Gooey Liquid Morphing Switch

A high-impact micro-interaction: the thumb is a blob of liquid that stretches, necks and snaps to the far side of the track like plasma — built with an inline SVG filter (feGaussianBlur + feColorMatrix) and two staggered CSS transitions. No JavaScript, no canvas.

Published

Bouncy Elastic Physics Toggle — preview
05 / 47Pure CSSNEW

Bouncy Elastic Physics Toggle

Premium landing-page motion in one line of CSS: an overshooting cubic-bezier makes the thumb wind up backwards, shoot across the track, and bounce gently off the far wall — playful, physics-driven, and still just a checkbox with a transition.

Published

Inner Text ON / OFF Switch — preview
06 / 47Pure CSSNEW

Inner Text ON / OFF Switch

The space-saving form control PMs ask for: a wider track carries 'ON' and 'OFF' nested inside it, and the sliding thumb covers the inactive word while the active one fades in — state is spelled out, never inferred from color alone.

Published

SaaS Pricing Segmented Pill Toggle — preview
07 / 47Pure CSSNEW

SaaS Pricing Segmented Pill Toggle

The Monthly / Annually switcher every pricing page needs: hidden radio buttons inside a single track, a background pill that glides behind the active label, a 'save 20%' badge — and the price below live-swaps, all without a line of JavaScript.

Published

Haptic Mechanical Keycap Toggles — preview
08 / 47CSS + JSNEW

Haptic Mechanical Keycap Toggles

A bank of mechanical keyboard keycaps that toggle settings: each cap physically travels down into its socket on press, latches with a backlit glow when on — and fires a real haptic pulse through the Vibration API on supporting devices.

Published

Waveform Mute Toggle — preview
09 / 47Pure CSSNEW

Waveform Mute Toggle

A mute switch that shows sound instead of describing it: five equalizer bars dance inside the pill while audio is live, then collapse to a flatline the instant you mute — state you can read from across the room, no thumb required.

Published

Timed Auto-Off Toggle — preview
10 / 47CSS + JSNEW

Timed Auto-Off Toggle

A self-disarming switch for risky settings: flip it on and a conic countdown ring drains around the control for 8 seconds, then the toggle flips itself back off — with the remaining time announced to screen readers. Think 'temporarily allow' permissions.

Published

Biometric Hold-to-Confirm Scan Toggle — preview
11 / 47CSS + JSNEW

Biometric Hold-to-Confirm Scan Toggle

A destructive-action guard styled as a fingerprint sensor: press and HOLD for 1.2 seconds while a scan line sweeps and a progress ring fills — release early and it disarms. Keyboard users get an equivalent hold on Space, and the final state is a real aria-checked switch.

Published

Split-Flap Departure Board Toggle — preview
12 / 47Pure CSSNEW

Split-Flap Departure Board Toggle

An airport departure-board cell that flips between OFF and ON: the top half of the card hinges down over the bottom in 3D, revealing the new state exactly like a mechanical split-flap display — hinge line, half-letters and all. Pure CSS.

Published

Permission Stack with Live Status — preview
13 / 47Pure CSSNEW

Permission Stack with Live Status

A settings-panel pattern: a stack of permission rows, each with its own mini switch — and a status badge in the header that flips between 'Full access' and 'Partial' by *watching the group* with :has(). The container reads its own children's state, no script.

Published

Material Design 3 Switch — preview
14 / 47Pure CSSNEW

Material Design 3 Switch

A faithful Material 3 switch, CSS-only: the small outlined thumb grows as it slides, a checkmark fades in on the handle, a state-layer halo blooms on hover and press — every spec detail (52×32 track, 2px outline, 16→24→28dp thumb) without the Material library.

Published

Skeuomorphic Wall Light Switch — preview
15 / 47Pure CSSNEW

Skeuomorphic Wall Light Switch

A realistic wall-plate rocker switch — beveled plate, screw heads, a paddle that tips in 3D perspective — and when you flip it, the whole room warms up: the section's ambient light brightens via :has(). Skeuomorphism with a functional payoff.

Published

Neon Cyberpunk Toggle — preview
16 / 47Pure CSSNEW

Neon Cyberpunk Toggle

A clipped-corner, neon-tube toggle for dark dashboards and game UIs: magenta standby glow snaps to cyan when engaged, the status text flickers to life like a striplight warming up, and every glow is pure layered box-shadow and text-shadow.

Published

Brutalist Snap Toggle — preview
17 / 47Pure CSSNEW

Brutalist Snap Toggle

Anti-animation as a statement: a raw, square switch with 3px black borders and a hard offset shadow. The block thumb doesn't glide — it SNAPS to the other side in a single 90ms step, the shadow jumps, and the state stamps itself in uppercase mono. Zero easing, zero apology.

Published

Day / Night Landscape Scene Switch — preview
18 / 47Pure CSSNEW

Day / Night Landscape Scene Switch

A wide cinematic toggle that IS a landscape: the sun arcs across a gradient sky and sets behind silhouetted mountains as a moon rises, stars pepper the dark, and the surrounding page follows the scene into night. The most shareable switch in the collection.

Published

3D Flip Card Toggle — preview
19 / 47Pure CSSNEW

3D Flip Card Toggle

A toggle that flips like a card on a table: the whole control rotates 180° in 3D to reveal its other face — muted gray 'Paused' on the front, vivid 'Active' on the back — turning a boolean into a satisfying physical object.

Published

Sliding Pill with Traveling Label — preview
20 / 47Pure CSSNEW

Sliding Pill with Traveling Label

The label rides IN the thumb: a wide pill where the sliding handle itself says 'Draft' or 'Live', crossfading its word mid-journey while ghost labels in the track show the destination. Ideal for publish switches where the state word must move with the control.

Published

Glassmorphism Frosted Toggle — preview
21 / 47Pure CSSNEW

Glassmorphism Frosted Toggle

A frosted-glass switch floating over a vivid gradient scene: the track is translucent, blurred glass (backdrop-filter) with a hairline light border, the thumb a denser frost puck — and the colorful blobs behind it visibly refract through both as it slides.

Published

Skeuomorphic Rotary Knob Toggle — preview
22 / 47Pure CSSNEW

Skeuomorphic Rotary Knob Toggle

A machined aluminum knob that rotates between OFF and ON detents: brushed-metal conic sheen, a milled indicator line, tick marks on the bezel, and a pilot LED that ignites at the ON detent. The checkbox IS the knob — click or Space twists it.

Published

iOS Light Mode Settings List — preview
23 / 47Pure CSSNEW

iOS Light Mode Settings List

The full iOS Settings context, not just the switch: a light grouped list with hairline separators, colored glyph tiles, and three native-feel toggles — the pattern to copy when you need a whole preferences screen, complete with section header and footnote.

Published

Outline Minimal currentColor Toggle — preview
24 / 47Pure CSSNEW

Outline Minimal currentColor Toggle

A stroke-only switch drawn entirely in currentColor: hollow track, hollow thumb that fills solid when on. Because it inherits its color from surrounding text, the SAME markup works on light cards, dark cards and brand-colored banners with zero per-theme CSS.

Published

Bouncy Pebble Organic Toggle — preview
25 / 47Pure CSSNEW

Bouncy Pebble Organic Toggle

A soft river pebble instead of a circle: the asymmetric blob thumb squashes flat as it launches, stretches mid-flight and wobbles back into shape on landing — squash-and-stretch cartoon physics from one keyframe block, in a warm organic palette.

Published

Industrial Rocker I/O Switch — preview
26 / 47Pure CSSNEW

Industrial Rocker I/O Switch

The power switch off the back of real hardware: a rectangular rocker with engraved I and O halves seesawing inside a riveted steel panel, plus a red pilot lamp that ignites on power. Perspective, gradients and text-shadow do all the machining.

Published

Accessible ARIA role=switch Toggle — preview
27 / 47CSS + JSNEW

Accessible ARIA role=switch Toggle

The reference implementation to ship in a design system: a button[role=switch] toggle with correct aria-checked handling, visible state text, a spec-grade focus ring — and it stays fully functional and visible in Windows High Contrast / forced-colors mode, where most CSS toggles silently vanish.

Published

Haptic Keys — preview
28 / 47Pure CSS

Haptic Keys

Chunky square key with a 3D press-depth shadow and a glowing accent ring on activate. Pressing literally sinks the button 3px while the hard bottom shadow collapses — pure tactile button metaphor for tactile UI trends.

PublishedUpdated

Waveform Toggle — preview
29 / 47Pure CSS

Waveform Toggle

Static audio bars spring to life with staggered breathing animations when toggled on. The track border and indicator dot pulse with an ice-cyan glow. Audio-visual data physicality — toggle = sound on/off.

PublishedUpdated

Timed Toggle — preview
30 / 47Pure CSS

Timed Toggle

An SVG arc fills around a circle when the toggle activates, visualising session time. Temporal UI for progress-aware states — users see state over time, not just on/off. The ember glow signals an active countdown.

PublishedUpdated

Biometric Scan — preview
31 / 47Pure CSS

Biometric Scan

A scanline sweeps top-to-bottom, corner brackets glow lilac, and the icon ring lights up when activated. Identity-first UI for auth flows — the toggle becomes a scan target instead of a switch.

PublishedUpdated

Split-Flap Board — preview
32 / 47Pure CSS

Split-Flap Board

A retro-mechanical airport departure board built from CSS-only rotateX flips. Toggling cycles both rows simultaneously — OFFLINE flips to ONLINE, STANDBY flips to ACTIVE — with each character flipping in sequence for the cascading split-flap feel.

PublishedUpdated

Permission Stack — preview
33 / 47Pure CSS

Permission Stack

Grouped consent UI with mini pill toggles inside stacked bordered rows. Each row independently grants or revokes a permission — the icon and label brighten and the pill switches to brand-green when granted. The dominant trust-first UI pattern replacing modal popups.

PublishedUpdated

iOS — preview
34 / 47Pure CSS

iOS

The reference iOS-style pill toggle — translucent track, white thumb with a subtle drop shadow, smooth slide on toggle. Honors prefers-reduced-motion.

PublishedUpdated

Material Design — preview
35 / 47Pure CSS

Material Design

Google Material Design 3 switch — track with rounded thumb that lifts and changes colour on toggle. Active state shows a filled icon-style indicator.

PublishedUpdated

Skeuomorphic Light Switch — preview
36 / 47Pure CSS

Skeuomorphic Light Switch

A physical rocker light switch — brushed metal bezel, plastic rocker that tilts on toggle, subtle shadow that deepens when pressed. Heavy realism, satisfying click.

PublishedUpdated

Neon Cyber — preview
37 / 47Pure CSS

Neon Cyber

A glowing neon outline toggle — dark track with a cyan thumb that pulses with a soft glow when active. Futuristic dashboard aesthetic.

PublishedUpdated

Brutalist — preview
38 / 47Pure CSS

Brutalist

Hard edges, no shadows, monospace label, raw markup feel. The track and thumb are pure rectangles. A counterpoint to polished SaaS-style toggles.

PublishedUpdated

Day / Night — preview
39 / 47Pure CSS

Day / Night

A dark-mode toggle that morphs from a sun in a sky-blue track to a crescent moon over a deep night track. The most "what does this control" pattern in the bunch.

PublishedUpdated

Flip Card — preview
40 / 47Pure CSS

Flip Card

A 3D flip toggle — front face shows OFF, back face shows ON. Rotates around the Y axis on toggle. Showcases transform-style: preserve-3d.

PublishedUpdated

Sliding Pill with Label — preview
41 / 47Pure CSS

Sliding Pill with Label

A track containing both labels (ON / OFF) with a thumb that slides over the active one. Common SaaS-dashboard pattern — the label IS the indicator.

PublishedUpdated

Glassmorphism — preview
42 / 47Pure CSS

Glassmorphism

A frosted-glass pill with a backdrop-blurred thumb. The colored backdrop tints the glass; the thumb floats above it. Modern dark-mode aesthetic.

PublishedUpdated

Skeuomorphic Knob — preview
43 / 47Pure CSS

Skeuomorphic Knob

A brushed-metal rotary knob that physically rotates 90 degrees on toggle. Different motion type from the sliding switches — rotation as the state signal. Tick marks anchor the dial.

PublishedUpdated

iOS Light Mode — preview
44 / 47Pure CSS

iOS Light Mode

The iOS toggle in its light-theme presentation — clean white card backdrop, soft gray off-state, signature green on-state. Counterpart to demo 1.

PublishedUpdated

Outline — preview
45 / 47Pure CSS

Outline

A pure-stroke toggle — track and thumb are outlines only, no fills. When toggled on, the thumb fills with brand color. Minimalist; pairs with the brutalist demo.

PublishedUpdated

Bouncy Pebble — preview
46 / 47Pure CSS

Bouncy Pebble

A chunky outlined toggle with an organic "pebble" thumb shape built from 8-value border-radius syntax. Bouncy springy transition with anticipation + overshoot. Track and thumb swap colors on each state. The reference for hand-crafted, designer-drawn toggles — distinctive from every other demo in the collection.

PublishedUpdated

Industrial Rocker — preview
47 / 47Pure CSS

Industrial Rocker

A chunky industrial rocker switch with twin indicator lights, rotating "teeth" along the rail, and a color-shifting metallic thumb. The off-light glows red; the on-light glows brand purple. Inspired by heavy-duty equipment power switches.

PublishedUpdated

FAQ

Frequently asked questions

How do I build a pure CSS toggle switch that stays accessible?
Start with a real <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?
Functionally they're the same control — under the hood both are an <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?
43 of the 47 demos are 100% pure CSS — the :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?
Yes — every switch keeps the real input in the DOM (visually hidden with the sr-only clip pattern, never 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?
Yes. Every demo is plain HTML + CSS (+ JS where noted) — no framework, no build step, no npm install. Drop the markup into any framework, rename 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?
Demo 07 (SaaS Pricing Segmented Pill Toggle) is the exact pattern used by Stripe, Vercel, Linear, Notion and every modern SaaS marketing page: a segmented pill with two labels (Monthly / Yearly) where the active option is marked by a sliding indicator that moves with 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?
The collection ships three system-native reference switches: Demo 01 (Minimal iOS-Style Toggle) reproduces the Apple UIKit switch — 51×31 track, 27px thumb, Apple green #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?
Compliance toggles have two hard constraints beyond visual polish: (1) the visible state must be unambiguous — a checked switch that looks 'off' at a glance is a dark-pattern violation the EU DPA and California CPPA both punish; (2) the switch must default to OFF for non-essential categories (GDPR Article 7 + CCPA §1798.135). Demo 06 (Inner Text ON/OFF Switch) is the safest compliance pattern because the state is spelled out, not inferred from colour alone — colour-blind users and low-contrast screens still read the state correctly. Demo 13 (Permission Stack with Live Status) is the multi-toggle pattern for a full consent centre — one switch per category (Necessary / Preferences / Statistics / Marketing), the 'Necessary' row disabled and always on, and a live status footer that reads how many categories are enabled via :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 preview

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 preview

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 preview

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.

Search CodeFronts

Loading…