aura

Select

The Select component is used to allow the user to select an option from a list of options.

Attributes

  • name (String): The name of the input.
  • options (Array): An array of options to display in the select dropdown.
  • value (String): The value of the selected option.

Basic Usage

For the most basic usage, you can use the aura:select component with a list of option tags inside it.

Copy to clipboard

<aura:select placeholder="Select an option" label="Select an option">
    <aura:select.option value="1">Option 1</aura:select.option>
    <aura:select.option value="2">Option 2</aura:select.option>
    <aura:select.option value="3">Option 3</aura:select.option>
</aura:select>

Advanced Usage

For more advanced usage, you can use the aura:select component with an array of options.

Copy to clipboard

<aura:select 
    placeholder="Select an option" 
    :options="['1' => 'Option 1', '2' => 'Option 2', '3' => 'Option 3']"
/>

Custom Design

Copy to clipboard

<aura:select custom placeholder="Select an option">
    <aura:select.option value="1">Option 1</aura:select.option>
    <aura:select.option value="2">Option 2</aura:select.option>
    <aura:select.option value="3">Option 3</aura:select.option>
</aura:select>