0

I have added a combobox in lwc using table structure and it is overflowing to the next column. Below is the code I used.

  <table class="slds-table slds-table_cell-buffer slds-table_bordered">
            <thead  class="slds-line-height_reset">
                <tr>
                <th  scope="col">
                    <div class="slds-truncate">Asset Type</div>
                    <div> <template if:true={assetTypeValues.data}>
                        <lightning-combobox name="progress"  placeholder="Choose on"
                            options={assetTypeValues.data.values} onchange={handleChange}>
                        </lightning-combobox>
                    </template></div>
                </th>
            </tr>
             </thead>
 </table>

output image

Can anyone help? Note: I need to display 15 columns using table structure and hence went with html table.

After applying the css the values are truncated as below after applying css

2 Answers 2

1

The lightning-combobox component uses the class .slds-dropdown_fluid to set the dropdown width using the variable --lwc-sizeXSmall which has a default value of 12rem.

Custom CSS can be used to overwrite this value as required.

<lightning-combobox
  class="combobox-custom-width"
  name="progress"
  placeholder="Select"
  options={options}
>
</lightning-combobox>
.combobox-custom-width{
    --lwc-sizeXSmall: 8rem;
}
2
  • I applied the CSS and it is now showing the picklist values as truncated. Attached screenshot above.
    – Aruna
    Commented Jun 23, 2023 at 6:29
  • Yes it is due to limited space. You can view the full text by hovering over it.
    – Sneh
    Commented Jun 23, 2023 at 15:05
0

<lightning-combobox class="combobox-custom-width" name="progress" placeholder="Select" options={options} style="width:320px;"

Please check it its working.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .