@@ -8,7 +8,7 @@ A highly customizable and accessible toggle component for Vue 3.
8
8
</p >
9
9
10
10
<p align =" center " >
11
- <img src =" . /public/vue-toggles.jpg" alt =" Vue Toggles Logo " />
11
+ <img src =" https://raw.githubusercontent.com/juliandreas/vue-toggles/master /public/vue-toggles.jpg" alt =" Vue Toggles Logo " />
12
12
</p >
13
13
14
14
## Introduction
@@ -26,7 +26,7 @@ What's left for you, when it comes to accessibility, is labeling the toggle corr
26
26
- A ` <label for="example-id">Toggle description</label> ` followed by the toggle component ` <VueToggles id="example-id" /> `
27
27
- Or an ` aria-label ` , for example ` <VueToggles aria-label="Toggle description" /> ` . Remember, you still need a visual text description of what the toggle does
28
28
29
- The ` focus ` -style is also left up to you — which you shouldn't remove. If you think the default is ugly, style it yourself!
29
+ The ` focus ` -style is also left up to you - which you shouldn't remove. If you think the default is ugly, style it yourself!
30
30
31
31
## Installation
32
32
@@ -43,21 +43,25 @@ import { VueToggles } from "vue-toggles";
43
43
### Import types
44
44
45
45
``` javascript
46
- import { type VueTogglesProps } from " vue-toggles" ;
46
+ import type { VueTogglesProps } from " vue-toggles" ;
47
+ ```
48
+
49
+ ``` javascript
50
+ import VueToggles , { type VueTogglesProps } from " vue-toggles" ;
47
51
```
48
52
49
53
## Usage
50
54
51
55
The toggle is very easy to use out of the box. The bare minimum for it to work is a ` @click ` -function and a ` :value ` -prop.
52
56
53
57
``` html
54
- <VueToggles :value =" example " @click =" example = !example " />
58
+ <VueToggles :value =" isChecked " @click =" isChecked = !isChecked " />
55
59
```
56
60
57
61
Or if you prefer the ` v-model ` -syntax:
58
62
59
63
``` html
60
- <VueToggles v-model =" example " />
64
+ <VueToggles v-model =" isChecked " />
61
65
```
62
66
63
67
## Options
@@ -79,22 +83,23 @@ You can also add more props to customize things like color and width/height.
79
83
80
84
## Properties
81
85
82
- | Name | Type | Default | Description |
83
- | ------------------ | ---------------- | --------- | ------------------------------------------------- |
84
- | value | Boolean | ` false ` | Initial state of the toggle button |
85
- | disabled | Boolean | ` false ` | Toggle does not react on mouse or keyboard events |
86
- | reverse | Boolean | ` false ` | Reverse toggle to Right to Left |
87
- | height | [ String, Number] | ` 25 ` | Height of the toggle in ` px ` |
88
- | width | [ String, Number] | ` 75 ` | Width of the toggle in ` px ` |
89
- | dotColor | String | ` #ffffff ` | Color of the toggle dot |
90
- | uncheckedBg | String | ` #939393 ` | Background color when the toggle is unchecked |
91
- | checkedBg | String | ` #5850ec ` | Background color when the toggle is checked |
92
- | uncheckedTextColor | String | ` #ffffff ` | Text color when the toggle is unchecked |
93
- | checkedTextColor | String | ` #ffffff ` | Text color when the toggle is checked |
94
- | uncheckedText | String | ` "" ` | Optional text when the toggle is unchecked |
95
- | checkedText | String | ` "" ` | Optional text when the toggle is checked |
96
- | fontSize | String | ` 12 ` | Font size in ` px ` |
97
- | fontWeight | String | ` normal ` | Font weight |
86
+ | Name | Type | Default | Description |
87
+ | ------------------ | ------- | --------- | ------------------------------------------------- |
88
+ | value | Boolean | ` false ` | Initial state of the toggle button |
89
+ | disabled | Boolean | ` false ` | Toggle does not react on mouse or keyboard events |
90
+ | reverse | Boolean | ` false ` | Reverse toggle to Right to Left |
91
+ | width | Number | ` 75 ` | Width of the toggle in ` px ` |
92
+ | height | Number | ` 25 ` | Height of the toggle in ` px ` |
93
+ | dotColor | String | ` #ffffff ` | Color of the toggle dot |
94
+ | dotSize | Number | ` 0 ` | Dot size in ` px ` |
95
+ | checkedBg | String | ` #5850ec ` | Background color when the toggle is checked |
96
+ | uncheckedBg | String | ` #939393 ` | Background color when the toggle is unchecked |
97
+ | checkedTextColor | String | ` #ffffff ` | Text color when the toggle is checked |
98
+ | uncheckedTextColor | String | ` #ffffff ` | Text color when the toggle is unchecked |
99
+ | uncheckedText | String | ` "" ` | Optional text when the toggle is unchecked |
100
+ | checkedText | String | ` "" ` | Optional text when the toggle is checked |
101
+ | fontSize | Number | ` 12 ` | Font size in ` px ` |
102
+ | fontWeight | String | ` normal ` | Font weight |
98
103
99
104
## Vue 2 support
100
105
0 commit comments