Angular Material Input Floating Label Default Color Change

Viewed 6870

Can i change the floating default purple color of the lable?

 <mat-form-field>
 <input matInput placeholder="My Lable" formControlName="my-Lable">
</mat-form-field>
2 Answers

I prefer <mat-label></mat-label> than *placeholder*

<mat-form-field>
<mat-label>Agent Code</mat-label>
<input matInput>
</mat-form-field>

then you just call it in css

mat-label {
  color: blue;
}

User color attribute of material theme: color="primary" or "accent" or "warn",for extra colors you can use custom themes,or override color in css file.

 <mat-form-field color="accent"> <------here
   <input matInput placeholder="My Lable" formControlName="my-Lable">
 </mat-form-field>
Related