More than one mat-icon or mat-icon-button as prefix or suffix in a mat-form-field are displayed in columns when appearance is other than 'legacy'.
They should display in row like in 'legacy' appearance.
They are displayed in column.
https://stackblitz.com/edit/material-multiple-presuffix
Behavior is not consistent accros mat-form-field appearances.
@angular/material 7.1.0
All browsers.
I see 2 solutions :
__Solution 1 :__
Remove this two rules :
:not(.mat-form-field-appearance-legacy).mat-form-field .mat-form-field-prefix .mat-icon,
:not(.mat-form-field-appearance-legacy).mat-form-field .mat-form-field-suffix .mat-icon {
display: block;
}
:not(.mat-form-field-appearance-legacy).mat-form-field .mat-form-field-prefix .mat-icon-button,
:not(.mat-form-field-appearance-legacy).mat-form-field .mat-form-field-suffix .mat-icon-button {
display: block;
}
__Solution 2 :__
Use flexbox for prefix and suffix :
.mat-form-field-prefix,
.mat-form-field-suffix {
display: inline-flex;
align-items: center;
}
Potentially related issues : #11650, #13094, #13322 & #13592
Fixed it for me on datepicker outlined input field.
.mat-form-field-flex {
align-items: center;
}
@aennafae thanks, it's the missing part for solution 2 to work properly.
Still an issue with Angular 10.0.0:
https://stackblitz.com/edit/angular-mat-form-field-multiple-suffix
as a workaround for this, use a single matSuffix div and arrange the items inside however you like: https://stackblitz.com/edit/material-multiple-presuffix-u7kax5?file=app%2Fform-field-prefix-suffix-example.html
Most helpful comment
as a workaround for this, use a single matSuffix div and arrange the items inside however you like: https://stackblitz.com/edit/material-multiple-presuffix-u7kax5?file=app%2Fform-field-prefix-suffix-example.html