@@ -9,9 +9,8 @@ All of the attributes that can be used with normal `<input>` and `<textarea>` el
9
9
on elements inside ` <mat-form-field> ` as well. This includes Angular directives such as ` ngModel `
10
10
and ` formControl ` .
11
11
12
- The only limitations are that the ` type ` attribute can only be one of the values supported by
13
- ` matInput ` and the native element cannot specify a ` placeholder ` attribute if the ` <mat-form-field> `
14
- also contains an ` <mat-placeholder> ` element.
12
+ The only limitation is that the ` type ` attribute can only be one of the values supported by
13
+ ` matInput ` .
15
14
16
15
### Supported ` <input> ` types
17
16
@@ -40,12 +39,11 @@ additional information about these features, see the
40
39
41
40
### Placeholder
42
41
43
- A placeholder is a text label displayed in the input area when the input does not contain text.
44
- When text is present, the placeholder will float above the input area. The placeholder can be
45
- specified either via a ` placeholder ` attribute on the input or a ` <mat-placeholder> ` element in the
46
- same form field as the ` matInput ` . The ` <mat-form-field> ` also has additional options for changing
47
- the behavior of the placeholder. For more information see the
48
- [ form field placeholder documentation] ( https://material.angular.io/components/form-field/overview#floating-placeholder ) .
42
+ The placeholder is text shown when the ` <mat-form-field> ` label is floating but the input is empty.
43
+ It is used to give the user an additional hint about what they should type in the input. The
44
+ placeholder can be specified by setting the ` placeholder ` attribute on the ` <input> ` or ` <textarea> `
45
+ element. In some cases that ` <mat-form-field> ` may use the placeholder as the label (see the
46
+ [ form field label documentation] ( https://material.angular.io/components/form-field/overview#floating-label ) ).
49
47
50
48
### Changing when error messages are shown
51
49
@@ -90,10 +88,9 @@ for detecting when an input becomes autofilled and changing the appearance of th
90
88
91
89
The ` matInput ` directive works with native ` <input> ` to provide an accessible experience.
92
90
93
- If a placeholder attribute is added to the input, or a ` mat-placeholder ` element is added
94
- in the form field, the placeholder text will automatically be used as the label for the input.
95
- If there's no placeholder specified, ` aria-label ` , ` aria-labelledby ` or ` <label for=...> ` should be
96
- added.
91
+ If the containing ` <mat-form-field> ` has a label it will automatically be used as the ` aria-label `
92
+ for the ` <input> ` . However, if there's no label specified in the form field, ` aria-label ` ,
93
+ ` aria-labelledby ` or ` <label for=...> ` should be added.
97
94
98
95
Any ` mat-error ` and ` mat-hint ` are automatically added to the input's ` aria-describedby ` list, and
99
96
` aria-invalid ` is automatically updated based on the input's validity state.
0 commit comments