How to adjust width of the element from angular: "p-multiselect", so that it is always as wide as the widest "li" element?

34 views Asked by At

I need help with below angular element. I can't make an automatic width with below p-multiSelect. I also uploaded the image where u can see, that some "li" elements are wider than p-multiSelect. I would really need to make width of p-multiSelect to the widest element of "li". So I can see all text "li" without bottom scroll.

html:

<p-multiSelect class="parameter_multiselect" [options]="parameters" [(ngModel)]="selectedParameters" optionLabel="displayName" defaultLabel="{{ 'global.pickParameters' | translate }}" [maxSelectedLabels]="1" selectedItemsLabel="Wybrane opcje: {0}" scrollHeight="60vh" appendTo="body" [virtualScroll]="parameters.length > 100" [virtualScrollItemSize]="48">

enter image description here

I tried tricks with inline-blocks, flex, width: auto;

1

There are 1 answers

2
Ailten On

have you try width: fit-content; on the p-multiSelect ?