Add custom classes or theme a custom form I have a custom form generated in a module.

I want to style the individual inputs by adding classes to them. 

Can I add them through the buildform()?

public function buildForm(array $form, FormStateInterface $form_state) {
  //Return array of form API elements
  $form['location'] = array(
    '#type' =&gt; 'textfield',
    '#placeholder' =&gt; 'Enter your suburb or postcode...',
  );
  $form['submit'] = array(
    '#type' =&gt; 'submit',
    '#value' =&gt; $this-&gt;t('Go'),
  );
  return $form;
}


If yes, how would I do this? I can't seem to find a good reference for parameters that can be passed into the $form array.

Alternatively, is there a way to pass the elements to a theme template like can be done with custom blogs or controllers?
You can add classes in #attributes:

$form['submit'] = array(
     '#type' =&gt; 'submit',
     '#value' =&gt; $this-&gt;t('Go'),
     '#attributes' =&gt; ['class' =&gt; ['button']],
);