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: packages/input/README.md
+29-6Lines changed: 29 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -46,6 +46,8 @@ This is just a quick overview. For an in-depth guide how to use the component ch
46
46
-`label`: The label text of the input. Required.
47
47
-`validation`: A vuelidate-like object, must contain properties named `$error` and `$dirty`. Required.
48
48
-`description`: Descriptive text giving a user more context on what form their input has to have. Optional.
49
+
-`descriptionPosition`: Controls if the position should be displayed underneath the input or between label and input; defaults to `bottom`.
50
+
-`isTextarea`: Render a textarea instead of an input element. Default to `false`.
49
51
50
52
### Styles
51
53
@@ -92,6 +94,32 @@ Ths will result in the following input:
92
94
93
95
💁 _Note:_ You do not need to pass in a `id`. A unique ID for every instance of the component is automatically generated.
94
96
97
+
### Textarea
98
+
99
+
`<input>`s and `<textarea>`s are quite similar, in that they can both hold text content, which might need validation and so forth. This is why, instead of having a separate component to add a `<textarea>`, you can change this one via the `isTextarea` prop to be one:
Input elements [must have a linked label](https://www.w3.org/TR/WCAG20-TECHS/H44.html) to give the input an accessible name.
@@ -157,7 +185,7 @@ No input without validation, right?
157
185
158
186
You will have to take care of this yourself, though. The component can and should not know what value is expected inside of it.
159
187
160
-
Nonetheless, I tried to make it as easy as possible to use the component along existing solutions like [Vuelidate](https://vuelidate.netlify.com/).
188
+
Nonetheless, we tried to make it as easy as possible to use the component along existing solutions like [Vuelidate](https://vuelidate.netlify.com/).
161
189
162
190
In fact, if you are already using Vuelidate, you are good to go.
163
191
@@ -205,11 +233,6 @@ This attribute could also be used to add styles based on the validated state.
205
233
.tournant-input__input[aria-invalid='true'] {
206
234
border-color: red;
207
235
}
208
-
209
-
/** [data-untouched is set on the input while `validation.$dirty is `false``] and can be used to only apply validated styles to touched and validated inputs */
template: `<tournant-input label="password" :validation="validation" value="" v-model="password" type="password" description="Your password must be unique to this site." />`
91
+
template: `
92
+
<tournant-input
93
+
label="password"
94
+
:validation="validation"
95
+
value=""
96
+
v-model="password"
97
+
type="password"
98
+
description="Your password must be unique to this site."
0 commit comments