Form Select not rendering as a dropdown I'm building a form that contains a select but it's not rendering as a dropdown. It's rendering with a scrollbar and a dropdown down arrow



$form['my_select'] = [
  '#type' =&gt; 'select',
  '#empty_option' =&gt; '- None -',
  '#title' =&gt; $this-&gt;t('My Select'),
  '#options' =&gt; ['Option1', 'Option2'],
  '#size' =&gt; 6,
  '#weight' =&gt; '0',
];


What am I doing wrong?
It's rendering as a list because you have set #size to 6, which means 6 rows will be visible. Either remove the #size property completely, or set it to 1 to display a normal dropdown.

From the documentation:


  #size: The number of rows in the list that should be visible at one time.