Lightning – Combobox vs Select

With the ever increasing base lightning components Salesforce is putting out, I’m always trying to move to the latest and greatest in hopes that through time, it will be supported better than legacy components (such as the ui namespace).

I have now having a tough time wrapping my head around when to use lightning:combobox and when to use lightning:select. Both of these components seem to overlap quite a bit, especially when talking about a simple picklist.

Can someone please provide an outline on the pro’s and con’s of each, and what scenarios each would be best fitted for?

Thanks!

Answer

Apparently, the difference is that one is used in the standard UI, and the other is not. If you want your components to look like the Lightning Experience, use lightning:combobox, but if you want something a little more compact, use lightning:select instead. The pro of lightning:combobox is that it is used in the standard UI (at least of Winter ’18), while lightning:select is apparently not. In addition, it has an options attribute to allow dynamically setting values in just one line of markup.

The pro of lightning:select is that it it is smaller. As for a con, it requires option values to be generated, which may be either hard-coded or aura:iteration elements. Either way, it requires significantly more markup to render the picklist.

Attribution
Source : Link , Question Author : techbusinessman , Answer Author : sfdcfox

Leave a Comment