Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to change color of mat-error (Angular Material)?

I'm using Angular Material's mat-error inside a form to show validation errors. These are by default displayed in orange. Is it possible to adjust its styling to make them red?

I tried:

mat-error{
    color: red !important;
}

With no success.

Thank you in advance!

like image 507
Gybelle Avatar asked Oct 16 '25 19:10

Gybelle


2 Answers

try this css.

 .mat-input-invalid .mat-input-placeholder {
    color: red;
}

.mat-input-invalid .mat-input-ripple {
    background-color: red;
}
like image 148
Sachila Ranawaka Avatar answered Oct 18 '25 14:10

Sachila Ranawaka


You can add it to :root {}

:root {
  .brand-theme .mat-error {
    color: red;
  }
} 
like image 42
publicmat Avatar answered Oct 18 '25 14:10

publicmat