[SalesForce] Controlling the height of a lightning-combobox dropdown

I have found that the lightning-combobox seems to get created with the default slds-dropdown_length-10 styling class. I want to reduce this drop down height, but so far cannot find a way to do so.

Wrapping a div with a set height around the lightning-combobox did nothing. Giving the lightning-combobox a class of slds-dropdown_length-5 did not provide nice results, I see no attribute to set in the documentation.

Did Salesforce seriously, for real, default the drop down to 10 items and provide NO way of modifying it for their LWC component? I find that entirely unbelievable… But I haven't found a way to do it from testing various css to trying to Google a workaround.

Best Answer

You cannot style the inner elements of the components if they're not exposed because of shadow DOM. But you can copy the open source version of the component and adapt it to your needs.

Related Topic