yarn add @konfy/vue-switch
Sizes: S / M / L (default m)
<vue-switch/>
<vue-switch size="s"/>
<vue-switch size="l" on/>
With label text
<vue-switch size="l" on>
<span slot="on">ON</span>
<span slot="off">OFF</span>
</vue-switch>
Custom color with css variables
.vue-switch.custom {
--switch-color-on: green;
--switch-color-off: pink;
}
.vue-switch.green {
--switch-color-on: #00BD8E;
}
property | type | default | comment |
---|---|---|---|
name | String | name of the input field | |
on | Boolean | false | on / off |
size | String | m | s m l |
disabled | Boolean | disable switch | |
loading | Boolean | loading state |
property | comment |
---|---|
value | input value |
method | comment |
---|---|
toggle() | toggle switch |
{
--switch-color-on: #2181FF;
--switch-color-off: #BBB;
--switch-color-disabled: #F3F3F3;
}