Description
What are you trying to do?
I am trying to migrate a large app using Angular Material to v15 and like many of us I have to overwrite some default styles on Angular Material components.
I am facing an issue with the new MatSelect v15. It seems that now the default behavior is to make the overlay-pane use the exact same width as its mat-select
related component, directly by setting the width to the element (.cdk-overlay-pane) styles.
If the mat-form-field
or mat-select
have a small width, the mat-option
texts get word wrapped and it is pretty ugly :
https://stackblitz.com/edit/angular-sbq67h?file=src/app/select-overview-example.html
Is there any way I could prevent this fixed width on the related .cdk-overlay-pane
for my mat-select
component ?
What troubleshooting steps have you tried?
Adding white-space: nowrap;
to .mat-mdc-option .mdc-list-item__primary-text
prevent the wrapping issue but the .cdk-overlay-pane
fixed width do not allow any overflow. The @input panelClass
can't help because .cdk-overlay-pane
is a parent.
Reproduction
Steps to reproduce:
Environment
- Angular: 15.0.4
- CDK/Material: 15.0.4
- Browser(s): Google Chrome v108
- Operating System (e.g. Windows, macOS, Ubuntu): Windows 10