You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| value | Boolean | false | Initial state of the toggle button |
55
-
| sync | Boolean | false | If set to `true`, will be watching changes in `value` property and overwrite the current state of the button whenever `value` prop changes |
56
-
| speed | Number | 300 | Transition time for the animation |
57
-
| disabled | Boolean | false | Button does not react on mouse events |
58
-
| color | [String, Object] | `#75C791` | If `String` - color of the button when checked <br>If `Object` - colors for the button when checked/unchecked or disabled<br>Example: `{checked: '#00FF00', unchecked: '#FF0000', disabled: '#CCCCCC'}` |
59
-
| cssColors | Boolean | false | If `true` - deactivates the setting of colors through inline styles in favor of using CSS styling |
60
-
| labels | [Boolean, Object] | false | If `Boolean` - shows/hides default labels ("on" and "off") <br>If `Object` - sets custom labels for both states. <br>Example: `{checked: 'Foo', unchecked: 'Bar'}` |
61
-
| switchColor | [String, Object] | `#BFCBD9` | If `String` - color or background property of the switch when checked <br>If `Object` - colors or background property for the switch when checked/uncheked <br>Example: `{checked: '#25EF02', unchecked: 'linear-gradient(red, yellow)'}` |
62
-
| width | Number | 50 | Width of the button, default is 50 |
63
-
| height | Number | 22 | Height of the button, default is 22 |
64
-
| name | String | undefined | Name to attach to the generated input field |
65
-
66
-
`labels` object accepts HTML text (for example, you can use FontAwesome for checked/unchecked states).
67
+
| Name | Type | Default | Description |
68
+
| --- | --- | --- | --- |
69
+
| value | Boolean | false | Initial state of the toggle button |
70
+
| sync | Boolean | false | If set to `true`, will be watching changes in `value` property and overwrite the current state of the button whenever `value` prop changes |
71
+
| speed | Number | 300 | Transition time for the animation |
72
+
| disabled | Boolean | false | Button does not react on mouse events |
73
+
| color |[String, Object]|`#75C791`| If `String` - color of the button when checked <br>If `Object` - colors for the button when checked/unchecked or disabled<br>Example: `{checked: '#00FF00', unchecked: '#FF0000', disabled: '#CCCCCC'}`|
74
+
| cssColors | Boolean | false | If `true` - deactivates the setting of colors through inline styles in favor of using CSS styling |
75
+
| labels |[Boolean, Object]| false | If `Boolean` - shows/hides default labels ("on" and "off") <br>If `Object` - sets custom labels for both states. <br>Example: `{checked: 'Foo', unchecked: 'Bar'}`|
76
+
| switchColor |[String, Object]|`#BFCBD9`| If `String` - color or background property of the switch when checked <br>If `Object` - colors or background property for the switch when checked/uncheked <br>Example: `{checked: '#25EF02', unchecked: 'linear-gradient(red, yellow)'}`|
77
+
| width | Number | 50 | Width of the button |
78
+
| height | Number | 22 | Height of the button |
79
+
| name | String | undefined | Name to attach to the generated input field |
80
+
| fontSize | Number | undefined | Font size |
67
81
68
82
### Events
69
83
70
84
| Name | Description |
71
85
| --- | --- |
72
86
| change | Triggered whenever state of the component changes. <br>Contains: <br>`value` - state of the object <br>`srcEvent` - source click event |
87
+
| input | Input event for v-model |
73
88
74
89
### SSR
75
90
76
91
Include plugin in your `nuxt.config.js` file:
92
+
77
93
```javascript
78
94
module.exports= {
79
95
plugins: ['~plugins/vue-js-toggle-button']
80
96
}
81
97
```
98
+
82
99
And your `plugins/vue-js-toggle-button.js` will look like:
0 commit comments