Switching off the floating label for Material Select in Angular 15?

Advertisements

This question indicates that it is possible to turn off the float for Angular Material and I tried it this solution:

.mat-form-field-can-float.mat-form-field-should-float .mat-form-field-label,
  .mat-form-field-can-float .mat-input-server:focus + .mat-form-field-label-wrapper .mat-form-field-label{
    display: none !important;
  }

However no love. Here’s the stackblitz attempt. The SCSS is placed in styles.scss.

Anyone know if it’s possible to turn off the float for select fields in Angular 15?

>Solution :

With the new API, it seems that to remove the floating placeholder, it should be

.mdc-notched-outline[ng-reflect-open='true'] .mdc-notched-outline__notch {
  display: none;
}

Leave a ReplyCancel reply