Based on the api documentation, shouldLabelFloat is a property of MatInput. But I'm still getting the error.
<mat-form-field>
<input matInput [shouldLabelFloat]="true" placeholder="First Name">
</mat-form-field>
After a bit of digging, it looks like the documentation site is a bit broken and shows properties that are meant to be private. There's currently a pull request that was already merged with this fix to remove private getters. Here's the code for more info.
Anyways, the correct property to use is the floatLabel input of MatFormField as follows:
<mat-form-field floatLabel="always">
<input matInput [(ngModel)]="firstName" placeholder="First name">
</mat-form-field>
The floatLabel input accepts three properties: auto, always or never.
Here's some references:
MatFormFieldIf you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With