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
Copy file name to clipboardExpand all lines: README.md
+53-24Lines changed: 53 additions & 24 deletions
Original file line number
Diff line number
Diff line change
@@ -1,5 +1,8 @@
1
1
#vue-formly-bootstrap
2
-
A plugin for [Vue Formly](https://github.com/matt-sanders/vue-formly) which adds multiple form fields according to Twitter Bootstrap.
2
+
A plugin for [Vue Formly](https://github.com/matt-sanders/vue-formly) which adds multiple form fields according to Twitter Bootstrap.
3
+
4
+
##Version 2
5
+
Note that this is version 2 of Vue Formly Bootstrap, compatible with Vue Formly 2 and Vue 2. If you are looking for version 1 compatibility check out the [Version 1 Branch](https://github.com/formly-js/vue-formly-bootstrap/tree/1.0).
If you include the script it will be installed for you.
54
66
55
-
For more advanced details about how to use Vue Formly check out the [docs](https://www.gitbook.com/book/matt-sanders/vue-formly/details).
67
+
For more advanced details about how to use Vue Formly check out the [docs](https://www.gitbook.com/book/matt-sanders/vue-formly/content/v/2.0).
56
68
57
69
Note that this is still a work in progress so some fields are under construction. See the [To Do](#to-do) section for what's on the watchlist.
58
70
59
-
##Options
71
+
##Options & Attributes
60
72
61
-
###Global options
62
-
These options are used by all the different field types. Some fields may have special options and these will be specified below.
73
+
###Form Attributes
74
+
The form object is used to track the state of the form. Whether it is valid or not, whether there are any errors etc. The following attributes will be set under each field key. e.g. if you had a field with the key of `name` you could access these under `form.name`
63
75
64
-
|Property| Type | Default | Description |
76
+
|Attribute| Type | Default | Description |
65
77
| --- | --- | --- | --- |
66
78
| $dirty |`boolean`|`false`|***RESTRICTED*** This is set by the system and is just there for your reference. It gets set to `true` upon blur or change, whichever happens first. |
67
79
| $active |`boolean`|`false`|***RESTRICTED*** Also set by the system and is set to true on focus. |
80
+
81
+
###Global options
82
+
These options are used by all the different field types. Some fields may have special options and these will be specified below. Check the [Vue Formly docs](https://matt-sanders.gitbooks.io/vue-formly/content/v/2.0/) for more info.
83
+
84
+
| Property | Type | Default | Description |
85
+
| --- | --- | --- | --- |
68
86
| type | `string` | `null` | ***REQUIRED*** this is the input type. Check the [Available Inputs](#available-inputs) section for a list of currently available inputs.
87
+
88
+
####Select options
89
+
90
+
| Property | Type | Default | Description |
91
+
| --- | --- | --- | --- |
92
+
| options |`array`|`null`| Pass either an array of strings or objects. Objects require a `label` and `value` property. If a string is passed then it will be used for the value and the label. eg: `options: ['Foo', 'Bar']` or `options: [{ label: 'Foo', value: 'bar'},{label: 'Bar', value: 'foo'}]`|
93
+
94
+
####List options
95
+
96
+
| Property | Type | Default | Description |
97
+
| --- | --- | --- | --- |
98
+
| options |`array`|`null`| Pass either an array of strings or objects. Objects require a `label` and `value` property. If a string is passed then it will be used for the value and the label. eg: `options: ['Foo', 'Bar']` or `options: [{ label: 'Foo', value: 'bar'},{label: 'Bar', value: 'foo'}]`|
99
+
| inputType |`string`|`checkbox`| The 'type' attribute to pass to each input. Can be either 'checkbox' or 'radio' |
100
+
101
+
###Template Options
102
+
These should be added to the `templateOptions` property. Some input types may have specific options which can be used here and will be specified below.
103
+
104
+
| Property | Type | Default | Description |
105
+
| --- | --- | --- | --- |
69
106
| onBlur |`function(e)`|`null`| A function to run on @blur event |
70
107
| onFocus |`function(e)`|`null`| A function to run on @focus event |
71
108
| onClick |`function(e)`|`null`| A function to run on @click event |
@@ -76,27 +113,19 @@ These options are used by all the different field types. Some fields may have sp
76
113
| classes |`object`|`null`| Pass an object of classes to be added to the element. Follows the Vue bindings where each key matches a boolean value. eg `{ 'class-a': true, 'class-b': false }` In this case class-a will be attached. |
77
114
| id |`string`|`null`| An ID string to attach to the element |
78
115
79
-
80
-
###Input options
116
+
####Input options
81
117
82
118
| Property | Type | Default | Description |
83
119
| --- | --- | --- | --- |
84
-
| inputType |`string`|`text`| The 'type' attribute to pass to the input. |
85
-
| files |`Object`|`null`|***RESTRICTED*** If you have set `inputType` to equal `file` then the `files` parameter will be populated by VueFormly to contain the corresponding files that have been uploaded |
86
-
120
+
| type |`string`|`text`| The 'type' attribute to pass to the input. Can be any valid input type. |
87
121
88
-
###Select options
89
-
90
-
| Property | Type | Default | Description |
91
-
| --- | --- | --- | --- |
92
-
| options |`array`|`null`| Pass either an array of strings or objects. Objects require a `label` and `value` property. If a string is passed then it will be used for the value and the label. eg: `options: ['Foo', 'Bar']` or `options: [{ label: 'Foo', value: 'bar'},{label: 'Bar', value: 'foo'}]`|
122
+
####List options
93
123
94
-
###List options
95
124
| Property | Type | Default | Description |
96
125
| --- | --- | --- | --- |
97
-
| options |`array`|`null`| Pass either an array of strings or objects. Objects require a `label` and `value` property. If a string is passed then it will be used for the value and the label. eg: `options: ['Foo', 'Bar']` or `options: [{ label: 'Foo', value: 'bar'},{label: 'Bar', value: 'foo'}]`|
98
126
| inputType |`string`|`checkbox`| The 'type' attribute to pass to each input. Can be either 'checkbox' or 'radio' |
0 commit comments