I am having trouble with the material mat-select initial selection box for the "drop-down" menu's width being the same size as the options in the mat-select-panel. I previously had a simple jQuery selection box, that had one width for the placeholder and a separate width for the selections/options. It seemed to do this automagically. I am now having trouble with Angular 6 material selection to have the different widths. It took me forever to find out how to change the widths in the first place. I finally changed it by using
Angular HTML:
<div id="selectionList">
<mat-form-field>
<mat select [ngclass]="{'selection-box-width' : true }" placeholder="Select an Option">
<mat-option *ngFor="let selection of selectionList">
Your {{selection.name}}
</mat-option>
</mat-select>
</mat-form-field>
</div>
and SCSS of
.selection-box-width {
min-width: 512px;
max-width: none;
}
The selection box (mat-select) always has the same width as the popup higher z-index (mat-select-panel). Should there be a way to change the widths and have them different?