Switching Off the Float Label of Our Angular Material Form Field | Task

Ole Ersoy
Feb - 16  -  1 min

Scenario

We have a material search form field:

<mat-form-field>
<input matInput placeholder="Search">
</mat-form-field>

And we want to turn off the floating label.

Approach

Just add floatLabel='never'.

<mat-form-field floatLabel='never'>
   <input matInput placeholder="Search">
</mat-form-field>