DevPlatform
Home
Components
Search
Submit
Earn
Login
Sign Up Free
toggle neon - Preview | DevPlatform
DevPlatform
Categories
Accordion
Animation
Box Shadow
Button
Card
Footer
Form
Gallery
Hero Section
Inputs
Loader
Marquee
Modal
Modules
Navbar
Progress Bar
Radio Buttons
Search-Bar
Sections
Slider
Tab
Timeline
Toggle
toggle neon
sachin007
Jan 25, 2026
2
0
Share
Live Preview
Refresh
Live Editor
HTML
CSS
JS
HTML
CSS
JavaScript
1
<div class="toggle-container"> <div class="toggle-switch" id="toggleSwitch"> <div class="toggle-slider"> <div class="glow-ring"></div> </div> </div> <div class="status-text" id="statusText">OFF</div> </div>
1
body { margin: 0; padding: 0; height: 100vh; display: flex; justify-content: center; align-items: center; background: #0a0a0a; font-family: 'Arial', sans-serif; } .toggle-container { text-align: center; } .toggle-label { color: #00ffff; font-size: 22px; margin-bottom: 40px; font-weight: 600; text-transform: uppercase; letter-spacing: 3px; text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff, 0 0 30px #00ffff; animation: pulse 2s ease-in-out infinite; } @keyframes pulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.7; } } .toggle-switch { position: relative; width: 120px; height: 60px; background: #1a1a1a; border-radius: 60px; cursor: pointer; border: 3px solid #333; transition: all 0.5s ease; overflow: hidden; } .toggle-switch::before { content: ''; position: absolute; top: -2px; left: -2px; right: -2px; bottom: -2px; background: linear-gradient(45deg, #ff00ff, #00ffff, #ff00ff); border-radius: 60px; opacity: 0; transition: opacity 0.5s ease; z-index: -1; animation: rotate 3s linear infinite; } @keyframes rotate { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } .toggle-switch.active::before { opacity: 1; } .toggle-switch.active { border-color: transparent; box-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, inset 0 0 20px rgba(0, 255, 255, 0.2); } .toggle-slider { position: absolute; top: 6px; left: 6px; width: 45px; height: 45px; background: linear-gradient(145deg, #2a2a2a, #1a1a1a); border-radius: 50%; transition: all 0.5s cubic-bezier(0.68, -0.55, 0.265, 1.55); border: 2px solid #444; box-shadow: 0 4px 15px rgba(0, 0, 0, 0.5), inset 0 -2px 5px rgba(0, 0, 0, 0.3); } .toggle-switch.active .toggle-slider { transform: translateX(60px); background: linear-gradient(145deg, #00ffff, #00cccc); border-color: #00ffff; box-shadow: 0 0 20px #00ffff, 0 0 40px #00ffff, 0 4px 15px rgba(0, 255, 255, 0.5), inset 0 -2px 5px rgba(0, 0, 0, 0.3); } .toggle-slider::after { content: ''; position: absolute; top: 50%; left: 50%; width: 10px; height: 10px; background: #666; border-radius: 50%; transform: translate(-50%, -50%); transition: all 0.5s ease; } .toggle-switch.active .toggle-slider::after { background: #fff; box-shadow: 0 0 10px #fff, 0 0 20px #00ffff; } .status-text { margin-top: 40px; color: #666; font-size: 18px; font-weight: 700; opacity: 0; transform: translateY(-20px); transition: all 0.5s ease; letter-spacing: 4px; text-transform: uppercase; } .status-text.show { opacity: 1; transform: translateY(0); } .toggle-switch.active ~ .status-text { color: #00ffff; text-shadow: 0 0 10px #00ffff, 0 0 20px #00ffff; } .glow-ring { position: absolute; top: 50%; left: 50%; width: 35px; height: 35px; border: 2px solid transparent; border-radius: 50%; transform: translate(-50%, -50%); transition: all 0.5s ease; } .toggle-switch.active .glow-ring { border-color: rgba(0, 255, 255, 0.5); animation: ripple 1.5s ease-out infinite; } @keyframes ripple { 0% { width: 35px; height: 35px; opacity: 1; } 100% { width: 60px; height: 60px; opacity: 0; } }
1
const toggleSwitch = document.getElementById('toggleSwitch'); const statusText = document.getElementById('statusText'); let isActive = false; toggleSwitch.addEventListener('click', function() { isActive = !isActive; if (isActive) { toggleSwitch.classList.add('active'); statusText.textContent = 'ON'; } else { toggleSwitch.classList.remove('active'); statusText.textContent = 'OFF'; } statusText.classList.remove('show'); setTimeout(() => { statusText.classList.add('show'); }, 50); }); // Show initial status setTimeout(() => { statusText.classList.add('show'); }, 100);
Comments
0
Want to comment?
Please
login
or
sign up
to post comments.
No comments yet
Be the first to comment on this component!
Comments 0
Want to comment?
Please login or sign up to post comments.
No comments yet
Be the first to comment on this component!