47 CSS Toggles & Switches37 / 47
Neon Cyber
A glowing neon outline toggle — dark track with a cyan thumb that pulses with a soft glow when active. Futuristic dashboard aesthetic.
Published Updated
The code
<label class="tgl-37">
<input class="tgl-37__input" type="checkbox" checked>
<span class="tgl-37__track" aria-hidden="true">
<span class="tgl-37__thumb"></span>
</span>
<span class="tgl-37__label">Shields</span>
</label><label class="tgl-37">
<input class="tgl-37__input" type="checkbox" checked>
<span class="tgl-37__track" aria-hidden="true">
<span class="tgl-37__thumb"></span>
</span>
<span class="tgl-37__label">Shields</span>
</label>.tgl-37 {
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
font-size: 11px;
color: #b8e8f0;
min-height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 24px;
padding: 48px 20px;
background: #14141e;
box-sizing: border-box;
}
.tgl-37__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
white-space: nowrap;
border: 0;
}
.tgl-37__track {
position: relative;
width: 54px;
height: 26px;
background: #0a1320;
border: 1px solid rgba(0, 220, 255, 0.3);
border-radius: 999px;
transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.tgl-37__thumb {
position: absolute;
top: 50%;
left: 3px;
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #6be8ff 0%, #0a90b8 100%);
transform: translateY(-50%);
box-shadow: 0 0 6px rgba(0, 220, 255, 0.4), inset 0 1px 1px rgba(255,255,255,0.4);
transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}
.tgl-37__input:checked ~ .tgl-37__track {
border-color: rgba(0, 220, 255, 0.9);
box-shadow: 0 0 12px rgba(0, 220, 255, 0.5), inset 0 0 8px rgba(0, 220, 255, 0.15);
}
.tgl-37__input:checked ~ .tgl-37__track .tgl-37__thumb {
left: 33px;
box-shadow: 0 0 14px rgba(0, 220, 255, 0.9), inset 0 1px 1px rgba(255,255,255,0.5);
}
.tgl-37__input:focus-visible ~ .tgl-37__track {
outline: 2px solid #6be8ff;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.tgl-37__track,
.tgl-37__thumb {
transition: none;
}
}.tgl-37 {
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
font-size: 11px;
color: #b8e8f0;
min-height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 24px;
padding: 48px 20px;
background: #14141e;
box-sizing: border-box;
}
.tgl-37__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
white-space: nowrap;
border: 0;
}
.tgl-37__track {
position: relative;
width: 54px;
height: 26px;
background: #0a1320;
border: 1px solid rgba(0, 220, 255, 0.3);
border-radius: 999px;
transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.tgl-37__thumb {
position: absolute;
top: 50%;
left: 3px;
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #6be8ff 0%, #0a90b8 100%);
transform: translateY(-50%);
box-shadow: 0 0 6px rgba(0, 220, 255, 0.4), inset 0 1px 1px rgba(255,255,255,0.4);
transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}
.tgl-37__input:checked ~ .tgl-37__track {
border-color: rgba(0, 220, 255, 0.9);
box-shadow: 0 0 12px rgba(0, 220, 255, 0.5), inset 0 0 8px rgba(0, 220, 255, 0.15);
}
.tgl-37__input:checked ~ .tgl-37__track .tgl-37__thumb {
left: 33px;
box-shadow: 0 0 14px rgba(0, 220, 255, 0.9), inset 0 1px 1px rgba(255,255,255,0.5);
}
.tgl-37__input:focus-visible ~ .tgl-37__track {
outline: 2px solid #6be8ff;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.tgl-37__track,
.tgl-37__thumb {
transition: none;
}
}/* No JavaScript — graded-alpha box-shadow layers ignite the track border and thumb orb on :checked. */
/* No JavaScript — graded-alpha box-shadow layers ignite the track border and thumb orb on :checked. */Here's a working CSS Toggles & Switche from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Neon Cyber
Source: https://codefronts.com/components/css-toggles-switches/neon-cyber/
A glowing neon outline toggle — dark track with a cyan thumb that pulses with a soft glow when active. Futuristic dashboard aesthetic.
## HTML
```html
<label class="tgl-37">
<input class="tgl-37__input" type="checkbox" checked>
<span class="tgl-37__track" aria-hidden="true">
<span class="tgl-37__thumb"></span>
</span>
<span class="tgl-37__label">Shields</span>
</label>
```
## CSS
```css
.tgl-37 {
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
font-size: 11px;
color: #b8e8f0;
min-height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 24px;
padding: 48px 20px;
background: #14141e;
box-sizing: border-box;
}
.tgl-37__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
white-space: nowrap;
border: 0;
}
.tgl-37__track {
position: relative;
width: 54px;
height: 26px;
background: #0a1320;
border: 1px solid rgba(0, 220, 255, 0.3);
border-radius: 999px;
transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.tgl-37__thumb {
position: absolute;
top: 50%;
left: 3px;
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #6be8ff 0%, #0a90b8 100%);
transform: translateY(-50%);
box-shadow: 0 0 6px rgba(0, 220, 255, 0.4), inset 0 1px 1px rgba(255,255,255,0.4);
transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}
.tgl-37__input:checked ~ .tgl-37__track {
border-color: rgba(0, 220, 255, 0.9);
box-shadow: 0 0 12px rgba(0, 220, 255, 0.5), inset 0 0 8px rgba(0, 220, 255, 0.15);
}
.tgl-37__input:checked ~ .tgl-37__track .tgl-37__thumb {
left: 33px;
box-shadow: 0 0 14px rgba(0, 220, 255, 0.9), inset 0 1px 1px rgba(255,255,255,0.5);
}
.tgl-37__input:focus-visible ~ .tgl-37__track {
outline: 2px solid #6be8ff;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.tgl-37__track,
.tgl-37__thumb {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — graded-alpha box-shadow layers ignite the track border and thumb orb on :checked. */
```Here's a working CSS Toggles & Switche from CodeFronts. Use it as-is or adapt to your framework. All classes are scoped under a unique prefix so the code won't collide with your existing styles. MIT licensed.
Demo: Neon Cyber
Source: https://codefronts.com/components/css-toggles-switches/neon-cyber/
A glowing neon outline toggle — dark track with a cyan thumb that pulses with a soft glow when active. Futuristic dashboard aesthetic.
## HTML
```html
<label class="tgl-37">
<input class="tgl-37__input" type="checkbox" checked>
<span class="tgl-37__track" aria-hidden="true">
<span class="tgl-37__thumb"></span>
</span>
<span class="tgl-37__label">Shields</span>
</label>
```
## CSS
```css
.tgl-37 {
font-family: "JetBrains Mono", "Fira Code", ui-monospace, monospace;
font-size: 11px;
color: #b8e8f0;
min-height: 100vh;
width: 100%;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 24px;
padding: 48px 20px;
background: #14141e;
box-sizing: border-box;
}
.tgl-37__input {
position: absolute;
width: 1px;
height: 1px;
padding: 0;
margin: -1px;
overflow: hidden;
clip: rect(0,0,0,0);
white-space: nowrap;
border: 0;
}
.tgl-37__track {
position: relative;
width: 54px;
height: 26px;
background: #0a1320;
border: 1px solid rgba(0, 220, 255, 0.3);
border-radius: 999px;
transition: border-color 0.25s ease, box-shadow 0.25s ease;
}
.tgl-37__thumb {
position: absolute;
top: 50%;
left: 3px;
width: 18px;
height: 18px;
border-radius: 50%;
background: radial-gradient(circle at 30% 30%, #6be8ff 0%, #0a90b8 100%);
transform: translateY(-50%);
box-shadow: 0 0 6px rgba(0, 220, 255, 0.4), inset 0 1px 1px rgba(255,255,255,0.4);
transition: left 0.25s cubic-bezier(0.4, 0, 0.2, 1), box-shadow 0.25s ease;
}
.tgl-37__input:checked ~ .tgl-37__track {
border-color: rgba(0, 220, 255, 0.9);
box-shadow: 0 0 12px rgba(0, 220, 255, 0.5), inset 0 0 8px rgba(0, 220, 255, 0.15);
}
.tgl-37__input:checked ~ .tgl-37__track .tgl-37__thumb {
left: 33px;
box-shadow: 0 0 14px rgba(0, 220, 255, 0.9), inset 0 1px 1px rgba(255,255,255,0.5);
}
.tgl-37__input:focus-visible ~ .tgl-37__track {
outline: 2px solid #6be8ff;
outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
.tgl-37__track,
.tgl-37__thumb {
transition: none;
}
}
```
## JavaScript
```js
/* No JavaScript — graded-alpha box-shadow layers ignite the track border and thumb orb on :checked. */
```How this works
A 54×26 void-dark track with a 30%-alpha cyan border idles dim; checking it drives the border to 90% alpha and adds a dual glow — 12px outer bloom plus an 8px inset wash — so the tube ignites from both sides of the glass. The 18px thumb is a radial-gradient orb with its own glow that intensifies from 6px to 14px as it slides.
All neon is layered box-shadow at graded alphas of one hue, so the entire demo rehues by changing the rgba stops. Monospace uppercase labeling does the cyberpunk typography work.
Make it yours
- Rehue by swapping the rgba(0,220,255) stops — magenta and acid green both work.
- Add an idle flicker keyframe on the border for a failing-tube vibe (gate behind prefers-reduced-motion).
- Thicken the border to 2px for stronger tube presence at larger sizes.
- Pair states: dim magenta off / cyan on, as in demo 16.
Gotchas — read before shipping
- Glow only reads on dark grounds — below ~15% background lightness.
- The thumb slides via
lefthere; swap to transform:translateX for strict INP budgets. - Keep at least the border-color change alongside glow — glow alone can vanish on low-quality displays.
Browser support
| Chrome | Safari | Firefox | Edge |
|---|---|---|---|
| 26+ | 9+ | 16+ | 26+ |
Layered box-shadows + transitions; universal in modern browsers.