angularangular-materialangular7angular-material-7

How Can I customize mat-form-field in disabled state


I am trying to customize the angular material mat-form-field : I was able to customize the underline border using :

::ng-deep.mat-form-field-ripple {
  background-color: yellow;
}

now I am trying to customize the underline border in the disabled state to be solid instead of the dashed line :

I tried this but it didn't work for underline :

::ng-deep.mat-form-field-disabled
 {

 }

enter image description here

I want this to be gray solid in disabled state

 <mat-form-field>
    <input matInput placeholder="Input" [disabled]='true'>
  </mat-form-field>

Solution

  • This Fixed it :

     ::ng-deep.mat-form-field-disabled .mat-form-field-underline 
        { 
        background-image: linear-gradient( to right, rgba(0, 0, 0, 1) 0, rgba(0, 0, 0, 0.42) 33%, #c2c7cc 0 ) !important; 
        background-size: 1px 100% !important;
         background-repeat: repeat-x !important; 
        }