I have a few lighting:select fields on my component. I populate the values of these fields by querying using apex. I also add the value "All" to each list. I then update the attribute with the values from my list.

How do I set the first value (which is 'All") as the value of the lightning:select.

Here is my current lightning:select field.

<lightning:layoutItem padding="around-small">
        <!-- Create a dropdown menu with options for Section code-->
        <lightning:select aura:id="selectGroupNum" label="GroupNum" name="sourceGroupNum" onchange="{!c.handleSelect}">
                 <aura:iteration items="{!v.groupnumbers}" var="gs">
                      <option value="{!gs}" text="{!gs}" />

groupnumbers is an attribute (declared as ) The values in that attribute are, for example, All,22222,77777,88888



1 Answer 1


You can achieve this with ui: element where you can set the value = true dynamically its not depends on the first value its more flexible. But you might need another variable to determine the value is true or false.

<ui:inputSelect class="single" aura:id="InputSelectSingle" >  
        <ui:inputSelectOption text="Any"/>
        <ui:inputSelectOption text="Open" value="true"/>
        <ui:inputSelectOption text="Closed"/>
        <ui:inputSelectOption text="Closed Won"/>
        <ui:inputSelectOption text="Prospecting"/>
        <ui:inputSelectOption text="Qualification"/>
        <ui:inputSelectOption text="Needs Analysis"/>
        <ui:inputSelectOption text="Closed Lost"/>
  • This could be another option using different component but this does not address OP’s query. You can always set a default value using lightning:select.
    – Jayant Das
    Jan 25, 2019 at 13:40

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