I have figured out a solutions for this situation.
- create a tempalte file for your form (ex. webform--newsletter.html.twig)
- there is a variable (element) where you can access each field of the form like this:
{{ element.elements.YOUR_FIELD_NAME }}
- you need to output the form action (submit) at the end of the form link this:
{{ element.actions }}
- the trick with this solution is that you need to output a couple of hidden form elements that is required for the form to be submitted properly:
{{ element.form_token }}
{{ element.form_build_id }}
{{ element.form_id }}
My final form template looks like this:
<div class="request-form">
<div class="form-wrap clearfix">
<div class="col-md-4 form-desc">
{{ element.elements.form_description }}
</div>
<div class="col-md-8">
<form{{ attributes }}>
{{ title_prefix }}
<div class="row">
<div class="col-md-6">
{{ element.elements.name }}
{{ element.elements.email }}
{{ element.elements.phone }}
</div>
<div class="col-md-6">
{{ element.elements.message }}
{{ element.form_token }}
{{ element.form_build_id }}
{{ element.form_id }}
{{ element.actions }}
</div>
</div>
{{ title_suffix }}
</form>
</div>
</div>
</div>
Hope that helps anyone else
Update:
I forgot to mention that you also need to print out the following element:
{{ element.form_token }}
Credit goes to maestrojed Webform twig template causes “the form has become outdated” error