jcb-switch
1.0.3 • Public • Published
npm install jcb-switch
index.html
<!DOCTYPE html>
<body>
<jcb-switch id="switch"></jcb-switch>
</body>
<script>
document.getElementById('switch').addEventListener('change', (event) => {
console.log('change', event.target, event.detail.value)
})
</script>
<style>
:root {
--jcb-switch-color: blue;
}
</style>
npm i jcb-switch
npm i parcel -g
parcel index.html
Name |
Type |
Default |
Description |
value |
Number |
0 |
State of switch: 1=on, 0=off |
Name |
Description |
Value |
change |
Emitted when switch is toggled |
event.detail.value = state |
Name |
Description |
--jcb-switch-color |
color of switch |
--jcb-switch-background-color |
color of switch background |
Package Sidebar
Install
Weekly Downloads