An easy drop-in material design vanilla custom toggle element. HTML form ready, no framework dependencies, small footprint.
npm install --save material-toggle
You need the webcomponents-lite polyfill.
Load the polyfill
and the material-toggle.js
in your html page or however you load you javascript dependencies:
<script src="webcomponents-lite.js"></script>
<script src="./node_modules/material-toggle/dist/material-toggle.js"></script>
Just drop an <material-toggle></material-toggle>
element into you html <form>
element and you are ready to go.
<label><material-toggle name="subscribe" id="subscribe"></material-toggle>Subscribe</label>
<label><material-toggle name="remind" id="remind" disabled></material-toggle>Remind</label>