1

Is it possible to mention the number of options to display in .

<lightning:select>
   <option>option 1</option>
   <option>option 2</option>
   <option>option 3</option>
   <option>option 4</option>
   <option>option 5</option>
   <option>option 6</option>
   <option>option 7</option>
   <option>option 8</option>
   <option>option 9</option>
   <option>option 10</option>
 </lightning:select>

I need to display only 5 options to display to see other options i need to scroll.

  • That is possible with multiselect="true" – itzmukeshy7 Feb 6 at 12:43
  • can you give more detail? – Ajith Feb 6 at 12:47
  • It's like that attribute will show you multiple options and the user will be able to select multiple options. – itzmukeshy7 Feb 6 at 12:51
0

You won't be able to use lightning:select (at least out of the box) to achieve what you are trying. The component always displays as drop down and that you will need to click on the component to render to view/select all of the options.

You can though achieve this using standard HTML select tag and using the size attribute as below.

<select size="5">
    <option>option 1</option>
    ....
    <option>option 10</option>
</select>

And it renders as:

enter image description here

  • 1
    I need drop down. If i click drop down then only i need options like this. – Ajith Feb 7 at 5:10
  • There’s no way that I know of that you can control this behavior. I don’t know if it can be done using custom css or not. – Jayant Das Feb 7 at 13:08

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.