Usa un elemento
input
con el atribto
type="checkbox" y
class="md-switch".
| 1 | <!DOCTYPE html> |
| 2 | <html lang="es" class="light dark"> |
| 3 | |
| 4 | <head> |
| 5 | |
| 6 | <meta charset="UTF-8"> |
| 7 | <title>Interruptores - PWA con MD</title> |
| 8 | |
| 9 | <script src="js/registraServiceWorker.js"></script> |
| 10 | |
| 11 | <meta name="viewport" content="width=device-width"> |
| 12 | <meta name="theme-color" content="#fffbfe"> |
| 13 | <link rel="icon" sizes="32x32" href="favicon.ico"> |
| 14 | <link rel="manifest" href="site.webmanifest"> |
| 15 | <script src="ungap/custom-elements.js"></script> |
| 16 | |
| 17 | <script type="module" src="js/configura.js"></script> |
| 18 | <link rel="stylesheet" href="css/estilos.css"> |
| 19 | <link rel="stylesheet" href="css/transicion_completa.css"> |
| 20 | |
| 21 | </head> |
| 22 | |
| 23 | <body> |
| 24 | |
| 25 | <md-top-app-bar> |
| 26 | |
| 27 | <h1>Interruptores</h1> |
| 28 | |
| 29 | <button is="md-menu-button" slot="navigation"></button> |
| 30 | |
| 31 | </md-top-app-bar> |
| 32 | |
| 33 | <main> |
| 34 | <p> |
| 35 | <label accesskey="R"> |
| 36 | Muestra resultados |
| 37 | <input type="checkbox" class="md-switch"> |
| 38 | </label> |
| 39 | </p> |
| 40 | </main> |
| 41 | |
| 42 | <nav-drw></nav-drw> |
| 43 | |
| 44 | </body> |
| 45 | |
| 46 | </html> |
Los interruptores en Material Design están defnidos en https://m3.material.io/components/switch/overview.