import {MatFormFieldModule} from '@angular/material/form-field';
MatError
Single error message to be shown underneath the form field.
Selector: mat-error
Name | Description |
---|---|
@Input()
|
MatFormField
Container for form controls that applies Material Design styling and behavior.
Selector: mat-form-field
Exported as: matFormFieldName | Description |
---|---|
@Input()
| The form-field appearance style. |
@Input()
| Theme color palette for the component. |
@Input()
| Whether the label should always float, never float or float as the user types. Note: only the legacy appearance supports the |
@Input()
| Whether the required marker should be hidden. |
@Input()
| Text for the form field hint. |
Deprecated
|
getConnectedOverlayOrigin | |
---|---|
Gets an ElementRef for the element that a overlay attached to the form-field should be positioned relative to. | |
Returns | |
ElementRef |
updateOutlineGap | |
---|---|
Updates the width and position of the gap in the outline. Only relevant for the outline appearance. |
MatHint
Hint text to be shown underneath the form field control.
Selector: mat-hint
Name | Description |
---|---|
@Input()
| Whether to align the hint label at the start or end of the line. |
@Input()
| Unique ID for the hint. Used for the aria-describedby on the form field control. |
MatPlaceholder
The placeholder text for an MatFormField
.
Selector: mat-placeholder
MatPrefix
Prefix to be placed the the front of the form field.
Selector: [matPrefix]
MatSuffix
Suffix to be placed at the end of the form field.
Selector: [matSuffix]
MatLabel
The floating label for a mat-form-field
.
Selector: mat-label
MatFormFieldControl
An interface which allows a control to work inside of a MatFormField
.
Name | Description |
---|---|
| Whether the input is currently in an autofilled state. If property is not present on the control it is assumed to be false. |
| An optional name for the control type that can be used to distinguish |
| Whether the control is disabled. |
| Whether the control is empty. |
| Whether the control is in an error state. |
| Whether the control is focused. |
| The element ID for this control. |
| Gets the NgControl for this control. |
| The placeholder for this control. |
| Whether the control is required. |
| Whether the |
| Stream that emits whenever the state of the control changes such that the parent |
| The value of the control. |
onContainerClick | |
---|---|
Handles a click on the control's container. | |
Parameters | |
event MouseEvent |
setDescribedByIds | |
---|---|
Sets the list of element IDs that currently describe this control. | |
Parameters | |
ids string[] |
MatFormFieldDefaultOptions
Represents the default options form the form field that can be configured using the MAT_FORM_FIELD_DEFAULT_OPTIONS
injection token.
Name | Description |
---|---|
|
MatFormFieldAppearance
Possible appearance styles for the form field.
Type: 'legacy' | 'standard' | 'fill' | 'outline'