JSFiddle - React, Tailwind, and code Playground
by ckissi
HTML
<!DOCTYPE html>
<html>
<head>
<style>
.glow-switch {
position: relative;
display: inline-block;
width: 60px;
height: 34px;
}
.glow-switch input {
opacity: 0;
width: 0;
height: 0;
}
.glow-slider {
position: absolute;
cursor: pointer;
top: 0;
left: 0;
right: 0;
bottom: 0;
background-color: #333;
transition: 0.4s;
border-radius: 34px;
border: 2px solid #666;
}
.glow-slider:before {
position: absolute;
content: "";
height: 26px;
width: 26px;
left: 2px;
bottom: 2px;
background-color: white;
transition: 0.4s;
border-radius: 50%;
}
input:checked + .glow-slider {
background-color: #222;
border-color: #00ff00;
box-shadow: 0 0 10px #00ff00,
0 0 20px #00ff00,
0 0 40px #00ff00;
}
input:checked + .glow-slider:before {
transform: translateX(26px);
background-color: #00ff00;
}
/* Animation */
@keyframes glow {
0% { box-shadow: 0 0 10px #00ff00; }
50% { box-shadow: 0 0 20px #00ff00; }
100% { box-shadow: 0 0 10px #00ff00; }
}
input:checked + .glow-slider {
animation: glow 1.5s infinite;
}
</style>
</head>
<body>
<label class="glow-switch">
<input type="checkbox">
<span class="glow-slider"></span>
</label>
</body>
</html>