How custom a form with twig
You need to implement hook_theme() in your .module file to define a new theme implementation, set the #theme key in your form to the name of your implementation and create a twig template with this same name, but replacing hyphens with underscores:

example.module

function example_theme() {
  return [
    'my_awesome_form' =&gt; [
      'render element' =&gt; 'form',
    ],
  ];


Form/MyAwesomeForm.php

class MyAwesomeForm extends FormBase {
  public function buildForm(array $form, FormStateInterface $form_state) {
    $form = parent::buildForm($form, $form_state);

    $form['#theme'] = 'my_awesome_form';
    [...]


templates/my-awesome-form.html.twig

&lt;form{{ attributes }}&gt;
  {{ form.form_build_id }}
  {{ form.form_token }}
  {{ form.form_id }}

  &lt;div class="row"&gt;
    &lt;div class="col-md-6"&gt;
      {{ form.name }}
    &lt;/div&gt;
    &lt;div class="col-md-6"&gt;
      {{ form.type }}
    &lt;/div&gt;
  &lt;/div&gt;
  [...]


In this example form.name and form.type are your form fields, the array keys that you used to create the form, and I used bootstrap markup to show them in two columns.

Hope this helps.

Regards.

PS: This is a copy of my post at https://www.drupal.org/node/2788835#comment-11785706. I cloned it here because I'm not allowed to post comments.