DevPlatform
Home
Components
Search
Submit
Earn
Login
Sign Up Free
toggle warning - 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 warning
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-label">⚠ Warning System</div> <div class="toggle-switch" id="toggleSwitch"> <div class="triangle-glow"></div> <div class="triangle-track"></div> <div class="energy-lines"> <div class="energy-line"></div> <div class="energy-line"></div> <div class="energy-line"></div> </div> <div class="warning-icon">⚡</div> <div class="triangle-particles"> <div class="particle"></div> <div class="particle"></div> <div class="particle"></div> </div> <div class="toggle-slider"></div> </div> <div class="status-text" id="statusText">SAFE</div> </div>
1
body { margin: 0; padding: 0; height: 100vh; display: flex; justify-content: center; align-items: center; background: linear-gradient(135deg, #1a1a00 0%, #2d2d00 50%, #1a1a00 100%); font-family: 'Arial', sans-serif; } .toggle-container { text-align: center; position: relative; } .toggle-label { color: #ffd700; font-size: 24px; margin-bottom: 50px; font-weight: 700; letter-spacing: 4px; text-transform: uppercase; text-shadow: 0 0 10px #ffff00, 0 0 20px #ffaa00, 0 0 30px #ff8800; animation: glow-pulse 2s ease-in-out infinite; } @keyframes glow-pulse { 0%, 100% { text-shadow: 0 0 10px #ffff00, 0 0 20px #ffaa00, 0 0 30px #ff8800; } 50% { text-shadow: 0 0 15px #ffff00, 0 0 30px #ffaa00, 0 0 45px #ff8800; } } .toggle-switch { position: relative; width: 200px; height: 180px; cursor: pointer; margin: 0 auto; } .triangle-track { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 100px solid transparent; border-right: 100px solid transparent; border-bottom: 173px solid #3a3a00; transition: all 0.5s ease; filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5)); } .triangle-track::before { content: ''; position: absolute; top: 5px; left: -95px; width: 0; height: 0; border-left: 95px solid transparent; border-right: 95px solid transparent; border-bottom: 164px solid #2a2a00; transition: all 0.5s ease; } .toggle-switch.active .triangle-track { border-bottom-color: #806600; filter: drop-shadow(0 8px 30px rgba(255, 215, 0, 0.6)); } .toggle-switch.active .triangle-track::before { border-bottom-color: #665200; } .triangle-glow { position: absolute; top: 0; left: 50%; transform: translateX(-50%); width: 0; height: 0; border-left: 110px solid transparent; border-right: 110px solid transparent; border-bottom: 190px solid rgba(255, 215, 0, 0); transition: all 0.5s ease; filter: blur(20px); opacity: 0; } .toggle-switch.active .triangle-glow { border-bottom-color: rgba(255, 215, 0, 0.3); opacity: 1; animation: triangle-pulse 2s ease-in-out infinite; } @keyframes triangle-pulse { 0%, 100% { filter: blur(20px); opacity: 0.8; } 50% { filter: blur(25px); opacity: 1; } } .toggle-slider { position: absolute; bottom: 20px; left: 50%; transform: translateX(-50%); width: 50px; height: 50px; background: linear-gradient(145deg, #4a4a00, #2a2a00); clip-path: polygon(50% 0%, 0% 100%, 100% 100%); transition: all 0.7s cubic-bezier(0.68, -0.55, 0.265, 1.55); filter: drop-shadow(0 4px 15px rgba(0, 0, 0, 0.8)); z-index: 10; } .toggle-switch.active .toggle-slider { transform: translateX(-50%) translateY(-120px) rotate(180deg); background: linear-gradient(145deg, #ffd700, #ffaa00); filter: drop-shadow(0 0 20px #ffd700) drop-shadow(0 0 40px #ffaa00); animation: slider-glow 1.5s ease-in-out infinite; } @keyframes slider-glow { 0%, 100% { filter: drop-shadow(0 0 20px #ffd700) drop-shadow(0 0 40px #ffaa00); } 50% { filter: drop-shadow(0 0 30px #ffd700) drop-shadow(0 0 60px #ffaa00); } } .warning-icon { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); font-size: 40px; opacity: 0; transition: all 0.5s ease; } .toggle-switch.active .warning-icon { opacity: 1; animation: warning-blink 1s ease-in-out infinite; } @keyframes warning-blink { 0%, 100% { opacity: 1; } 50% { opacity: 0.5; } } .triangle-particles { position: absolute; top: 0; left: 0; width: 100%; height: 100%; pointer-events: none; } .particle { position: absolute; width: 0; height: 0; border-left: 8px solid transparent; border-right: 8px solid transparent; border-bottom: 14px solid #ffd700; opacity: 0; } .toggle-switch.active .particle { animation: float-particle 3s ease-in-out infinite; } .toggle-switch.active .particle:nth-child(1) { left: 30%; animation-delay: 0s; } .toggle-switch.active .particle:nth-child(2) { left: 50%; animation-delay: 0.5s; } .toggle-switch.active .particle:nth-child(3) { left: 70%; animation-delay: 1s; } @keyframes float-particle { 0% { bottom: 0; opacity: 0; transform: rotate(0deg); } 20% { opacity: 0.8; } 100% { bottom: 180px; opacity: 0; transform: rotate(180deg); } } .status-text { margin-top: 60px; color: #665200; font-size: 20px; font-weight: 700; letter-spacing: 3px; text-transform: uppercase; transition: all 0.5s ease; } .toggle-switch.active ~ .status-text { color: #ffd700; text-shadow: 0 0 10px #ffff00, 0 0 20px #ffaa00; } .energy-lines { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 120px; height: 120px; opacity: 0; transition: opacity 0.5s ease; } .toggle-switch.active .energy-lines { opacity: 1; } .energy-line { position: absolute; width: 2px; height: 60px; background: linear-gradient(to bottom, transparent, #ffd700, transparent); left: 50%; top: 50%; transform-origin: center; animation: rotate-lines 4s linear infinite; } .energy-line:nth-child(1) { transform: translate(-50%, -50%) rotate(0deg); } .energy-line:nth-child(2) { transform: translate(-50%, -50%) rotate(60deg); } .energy-line:nth-child(3) { transform: translate(-50%, -50%) rotate(120deg); } @keyframes rotate-lines { from { transform: translate(-50%, -50%) rotate(0deg); } to { transform: translate(-50%, -50%) rotate(360deg); } }
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 = 'ALERT!'; } else { toggleSwitch.classList.remove('active'); statusText.textContent = 'SAFE'; } });
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!