Input Select (Deprecated)
ui:inputSelect
Deprecated as of API version 47.0. We recommend migrating to Lightning Web Components and using the lightning-combobox component.
For Use In
Lightning Experience, Experience Builder Sites, Salesforce Mobile App, Lightning Out (Beta), Standalone Lightning App
We recommend using Lightning Web Components whenever possible. When migrating to Lightning Web Components, use lightning-combobox for desktop devices. To support mobile screens, use the HTML select element.
For more information, see Aura Components in the ui Namespace Are Deprecated.
A ui:inputSelect component is rendered as an HTML select element. To apply Lightning Design System styling, we recommend that you use lightning:select instead of ui:inputSelect.
ui:inputSelect contains options, represented by the ui:inputSelectOption components. To enable multiple selections, set multiple="true". To wire up any client-side logic when an input value is selected, use the change event.
v.value represents the option's HTML selected attribute, and v.text represents the option's
HTML value attribute.
You can use aura:iteration to iterate over a list of items to generate options. This example iterates over a list of items and handles the change event.
When the selected option changes, this client-side controller retrieves the new text value.
Generate the options dynamically on component initialization using a controller-side action.
The following client-side controller generates options using the options attribute on the ui:inputSelect component. v.options takes in the list of objects and converts them into list options. The opts object constructs InputOption objects to create the ui:inputSelectOptions components within ui:inputSelect. Although the sample code generates the options during initialization, the list of options can be modified anytime when you manipulate the list in v.options. The component automatically updates itself and rerenders with the new options.
class is a reserved keyword that might not work with older versions of Internet Explorer. We recommend using "class" with double quotes. If you’re reusing the same set of options on multiple drop-down lists, use different attributes for each set of options. Otherwise, selecting a different option in one list also updates other list options bound to the same attribute.
Using ui:inputSelect with Lightning Runtime for Flows is supported, but empty option labels are not supported. To create a picklist field on an object and set an empty default value, use a formula inside the flow to substitute empty values to a value like --EMPTY--. Using the substitute value ensures that the empty picklist value does not get replaced by the label of the picklist variable created in the flow.