DevPlatform
Home
Components
Search
Submit
Earn
Login
Sign Up Free
toggle plus - 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 plus
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="decorative-circles"> <div class="circle circle-1"></div> <div class="circle circle-2"></div> </div> <div class="toggle-track-bg"></div> <div class="toggle-slider"> <div class="slider-icon"></div> </div> </div> <div class="status-indicator"> <div class="status-dot"></div> <div class="status-text" id="statusText">INACTIVE</div> </div> </div>
1
body { margin: 0; padding: 0; height: 100vh; display: flex; justify-content: center; align-items: center; background: #e0e5ec; font-family: 'Arial', sans-serif; } .toggle-container { text-align: center; padding: 40px; background: #e0e5ec; border-radius: 30px; box-shadow: 20px 20px 60px #bebec3, -20px -20px 60px #ffffff; } .toggle-label { color: #6b7280; font-size: 16px; margin-bottom: 30px; font-weight: 600; letter-spacing: 1px; text-transform: uppercase; } .toggle-switch { position: relative; width: 140px; height: 70px; background: #e0e5ec; border-radius: 70px; cursor: pointer; transition: all 0.6s ease; box-shadow: inset 8px 8px 16px #bebec3, inset -8px -8px 16px #ffffff; margin: 0 auto; } .toggle-switch.active { box-shadow: inset 8px 8px 16px #a3b9cc, inset -8px -8px 16px #c9dded; } .toggle-track-bg { position: absolute; top: 50%; left: 20px; right: 20px; height: 4px; background: linear-gradient(90deg, #d1d9e6 0%, #e0e5ec 100%); transform: translateY(-50%); border-radius: 4px; transition: all 0.6s ease; } .toggle-switch.active .toggle-track-bg { background: linear-gradient(90deg, #a8d5ff 0%, #7dd3fc 100%); } .toggle-slider { position: absolute; top: 8px; left: 8px; width: 54px; height: 54px; background: linear-gradient(145deg, #f0f4f8, #d9e2ec); border-radius: 50%; transition: all 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); box-shadow: 6px 6px 12px #bebec3, -6px -6px 12px #ffffff; display: flex; align-items: center; justify-content: center; } .toggle-switch.active .toggle-slider { transform: translateX(70px); background: linear-gradient(145deg, #60a5fa, #3b82f6); box-shadow: 6px 6px 12px #a3b9cc, -6px -6px 12px #c9dded, 0 0 20px rgba(59, 130, 246, 0.3); } .slider-icon { width: 24px; height: 24px; transition: all 0.6s ease; } .slider-icon::before, .slider-icon::after { content: ''; position: absolute; background: #9ca3af; border-radius: 2px; transition: all 0.6s ease; } .slider-icon::before { width: 20px; height: 3px; top: 50%; left: 50%; transform: translate(-50%, -50%); } .slider-icon::after { width: 3px; height: 20px; top: 50%; left: 50%; transform: translate(-50%, -50%); } .toggle-switch.active .slider-icon::before { width: 18px; background: #ffffff; transform: translate(-50%, -50%) rotate(45deg); } .toggle-switch.active .slider-icon::after { height: 10px; background: #ffffff; transform: translate(-150%, -50%) rotate(45deg); width: 3px; } .status-indicator { display: flex; align-items: center; justify-content: center; margin-top: 30px; gap: 10px; } .status-dot { width: 12px; height: 12px; border-radius: 50%; background: #d1d5db; box-shadow: inset 2px 2px 4px #bebec3, inset -2px -2px 4px #ffffff; transition: all 0.6s ease; } .toggle-switch.active ~ .status-indicator .status-dot { background: #60a5fa; box-shadow: 0 0 10px rgba(59, 130, 246, 0.5), inset 1px 1px 2px rgba(0, 0, 0, 0.1); } .status-text { color: #6b7280; font-size: 14px; font-weight: 600; letter-spacing: 1px; transition: all 0.6s ease; } .toggle-switch.active ~ .status-indicator .status-text { color: #3b82f6; } .decorative-circles { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 100%; height: 100%; pointer-events: none; } .circle { position: absolute; border-radius: 50%; border: 2px solid #d1d5db; opacity: 0; transition: all 0.6s ease; } .circle-1 { width: 60px; height: 60px; top: 5px; left: 5px; } .circle-2 { width: 70px; height: 70px; top: 0; left: 0; } .toggle-switch.active .circle { opacity: 0.3; border-color: #60a5fa; } .toggle-switch.active .circle-1 { transform: scale(1.1); } .toggle-switch.active .circle-2 { transform: scale(1.15); }
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 = 'ACTIVE'; } else { toggleSwitch.classList.remove('active'); statusText.textContent = 'INACTIVE'; } });
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!