screen_rotation
Copied to Clipboard
<html> <head> <script type="importmap"> { "imports": { "vue": "https://unpkg.com/vue@3/dist/vue.esm-browser.js" } } </script> <body> <div id="app"> <h3>Vue Js Toggle Switch | On | Off</h3> <label> <input type="checkbox" v-model="switchValue" /> <span class="toggle"></span> </label> <p>{{ switchValue ? 'On' : 'Off' }}</p> </div> <script type="module"> import { createApp } from "vue"; createApp({ data() { return { switchValue: false } }, }).mount("#app"); </script> <style> .toggle { display: inline-block; width: 50px; height: 24px; background-color: #ddd; border-radius: 34px; position: relative; cursor: pointer; transition: background-color 0.2s; box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.1); } input[type="checkbox"] { display: none; } input[type="checkbox"]:checked+.toggle { background-color: #4cd964; } input[type="checkbox"]:checked+.toggle::before { transform: translateX(26px); } .toggle::before { content: ""; display: block; width: 20px; height: 20px; background-color: #fff; border-radius: 50%; position: absolute; top: 2px; left: 2px; transition: transform 0.2s; box-shadow: 0 2px 6px 0 rgba(0, 0, 0, 0.1); } </style> </body> </head> </html>