1.0.3 • Published 4 years ago

jcb-switch v1.0.3

Weekly downloads
-
License
MIT
Repository
gitlab
Last release
4 years ago

Install

npm install jcb-switch

Usage example

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

API references

jcb-switch

Properties

NameTypeDefaultDescription
valueNumber0State of switch: 1=on, 0=off

Events

NameDescriptionValue
changeEmitted when switch is toggledevent.detail.value = state

CSS variables

NameDescription
--jcb-switch-colorcolor of switch
--jcb-switch-background-colorcolor of switch background
1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago