20 Pure CSS Toggles & Switches

A CSS toggle (or switch) is the binary on/off control most often used for settings — distinct from a checkbox by its visual emphasis on the current state. These 20 hand-coded toggles are accessible, keyboard-friendly, and zero-JS — copy the markup, label the state, and ship.

20 unique toggles 100% copy-paste ready Published
01 / 20
Haptic Keys
Pure CSS
Haptic Keys — preview
Chunky square key with a 3D press-depth shadow and a glowing accent ring on activate.
02 / 20
Waveform Toggle
Pure CSS
Waveform Toggle — preview
Static audio bars spring to life with staggered breathing animations when toggled on.
03 / 20
Timed Toggle
Pure CSS
Timed Toggle — preview
An SVG arc fills around a circle when the toggle activates, visualising session time.
04 / 20
Biometric Scan
Pure CSS
Biometric Scan — preview
A scanline sweeps top-to-bottom, corner brackets glow lilac, and the icon ring lights up when activated.
05 / 20
Split-Flap Board
Pure CSS
Split-Flap Board — preview
A retro-mechanical airport departure board built from CSS-only rotateX flips.
06 / 20
Permission Stack
Pure CSS
Permission Stack — preview
Grouped consent UI with mini pill toggles inside stacked bordered rows.
07 / 20
iOS
Pure CSS
iOS — preview
The reference iOS-style pill toggle — translucent track, white thumb with a subtle drop shadow, smooth slide on toggle.
08 / 20
Material Design
Pure CSS
Material Design — preview
Google Material Design 3 switch — track with rounded thumb that lifts and changes colour on toggle.
09 / 20
Skeuomorphic Light Switch
Pure CSS
Skeuomorphic Light Switch — preview
A physical rocker light switch — brushed metal bezel, plastic rocker that tilts on toggle, subtle shadow that deepens when pressed.
10 / 20
Neon Cyber
Pure CSS
Neon Cyber — preview
A glowing neon outline toggle — dark track with a cyan thumb that pulses with a soft glow when active.
11 / 20
Brutalist
Pure CSS
Brutalist — preview
Hard edges, no shadows, monospace label, raw markup feel.
12 / 20
Day / Night
Pure CSS
Day / Night — preview
A dark-mode toggle that morphs from a sun in a sky-blue track to a crescent moon over a deep night track.
Advertisement
13 / 20
Flip Card
Pure CSS
Flip Card — preview
A 3D flip toggle — front face shows OFF, back face shows ON.
14 / 20
Sliding Pill with Label
Pure CSS
Sliding Pill with Label — preview
A track containing both labels (ON / OFF) with a thumb that slides over the active one.
15 / 20
Glassmorphism
Pure CSS
Glassmorphism — preview
A frosted-glass pill with a backdrop-blurred thumb.
16 / 20
Skeuomorphic Knob
Pure CSS
Skeuomorphic Knob — preview
A brushed-metal rotary knob that physically rotates 90 degrees on toggle.
17 / 20
iOS Light Mode
Pure CSS
iOS Light Mode — preview
The iOS toggle in its light-theme presentation — clean white card backdrop, soft gray off-state, signature green on-state.
18 / 20
Outline
Pure CSS
Outline — preview
A pure-stroke toggle — track and thumb are outlines only, no fills.
19 / 20
Bouncy Pebble
Pure CSS
Bouncy Pebble — preview
A chunky outlined toggle with an organic "pebble" thumb shape built from 8-value border-radius syntax.
20 / 20
Industrial Rocker
Pure CSS
Industrial Rocker — preview
A chunky industrial rocker switch with twin indicator lights, rotating "teeth" along the rail, and a color-shifting metallic thumb.
FAQ

Frequently asked questions

How do I make a toggle switch in pure CSS?
Start from a real input type=checkbox — visually hide it but keep it in the DOM — and style a sibling label as the track, with a ::before or ::after pseudo-element as the sliding knob. The :checked pseudo-class moves the knob and recolours the track. All 20 switches here use this checkbox-driven pattern, so they stay accessible while looking fully custom.
What's the difference between a toggle switch and a checkbox?
Functionally they're the same control — both are an input type=checkbox under the hood. The difference is meaning and visuals: a checkbox suits 'select this option' choices, often in a group you submit later; a toggle switch suits an instant on/off setting (like dark mode or notifications) that takes effect immediately. A switch is just a checkbox styled to look like a physical switch.
Can a CSS toggle switch work without JavaScript?
Yes — all 20 toggles here are 100% pure CSS, zero JavaScript. The hidden checkbox's :checked state drives the entire animation: the knob slide, track colour, and any glow or bounce all come from input:checked ~ label rules.
Are these CSS toggle switches accessible?
Yes. Every switch keeps the real input type=checkbox (visually hidden, never display:none, so it stays focusable), tied to a label. Keyboard users Tab to it and toggle with Space, a visible focus state is provided, and continuous motion honours prefers-reduced-motion. For a true switch role, add role='switch' and aria-checked on real applications.
Can I use these toggle switches in React or other frameworks?
Yes. Each toggle is plain HTML and CSS — no dependencies, no build step. Drop the markup into React (use className and htmlFor), Vue, Svelte, Astro or static HTML and it works unchanged. All 20 designs are MIT licensed and free for commercial use.

Search CodeFronts

Loading…