Code
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>Document</title>
<link href="https://unpkg.com/[email protected]^1.0/dist/tailwind.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/gh/alpinejs/[email protected]/dist/alpine.min.js" defer></script>
<link href="https://fonts.googleapis.com/css?family=Source+Code+Pro|Roboto&display=swap" rel="stylesheet">
</head>
<style>
.slider {
background-color: #ccc;
-webkit-transition: .4s;
transition: .4s;
}
.slider:before {
position: absolute;
content: "";
height: 2rem;
width: 2rem;
left: 4px;
bottom: 4px;
background-color: white;
-webkit-transition: .4s;
transition: .4s;
}
.switch input {
opacity: 0;
width: 0;
height: 0;
}
input:checked + .slider {
background-color: #2196F3;
}
input:focus + .slider {
box-shadow: 0 0 1px #2196F3;
}
input:checked + .slider:before {
-webkit-transform: translateX(26px);
-ms-transform: translateX(26px);
transform: translateX(26px);
}
.slider.round:before {
border-radius: 50%;
}
</style>
<body style="font-family:Roboto">
<div class="flex justify-center items-center h-screen md:-mx-4">
<label class="switch relative inline-block w-16 h-10 mr-4">
<input type="checkbox">
<span class="slider cursor-pointer inset-0 absolute round rounded-full"></span>
</label>
<label class="switch relative inline-block w-16 h-10">
<input type="checkbox" checked>
<span class="slider cursor-pointer inset-0 absolute round rounded-full"></span>
</label>
</div>
</body>
</html>