jcb-switch

1.0.3 • Public • Published

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

Name Type Default Description
value Number 0 State of switch: 1=on, 0=off

Events

Name Description Value
change Emitted when switch is toggled event.detail.value = state

CSS variables

Name Description
--jcb-switch-color color of switch
--jcb-switch-background-color color of switch background

Readme

Keywords

Package Sidebar

Install

npm i jcb-switch

Weekly Downloads

0

Version

1.0.3

License

MIT

Unpacked Size

5.72 kB

Total Files

4

Last publish

Collaborators

  • jcbuisson