adding drop-down subject (html select) to contact form I would like to add a select field like a drop-down in the contact form to let user select the reason why they contact (contact, customer support, etc.)

Based on this (excellent) answer Adding check boxes to contact form, i’ve managed to create a field with check box :

source : Adding check boxes to contact form

How can i do that with a select ?

Solution :

You can choose in the "manage form display". The column "widget" allow to choose "Select list" (see screenshot)
There is a select form element that you can add to your buildForm or hook override, depending on how you are building your form:

$form['example_select'] = [
  '#type' =&gt; 'select',
  '#title' =&gt; $this-&gt;t('Select element'),
  '#options' =&gt; [
    '1' =&gt; $this-&gt;t('Contact'),
    '2' =&gt; $this-&gt;t('Other'),
    '3' =&gt; $this-&gt;t('Customer Support'),
  ],
];


This is from the Drupal documentation: https://api.drupal.org/api/drupal/core!lib!Drupal!Core!Render!Element!Select.php/class/Select/8.2.x.