How to add html tag in a form element?
I can't tell which element is giving you trouble.

For the div, instead of prefix/suffix you can create a container element:

$form['submit_container'] = array(
  '#type' =&gt; 'container',
  '#attributes' =&gt; array(
    'class' =&gt; ['modal-footer'],
  )
);


And then you can put a submit input inside of that:

$form['submit_container']['submit'] = array(
  '#type' =&gt; 'submit',
  '#value' =&gt; $this-&gt;t('Submit'),
  '#attributes' =&gt; array(
    'class' =&gt; ['btn', 'btn-sm', 'btn-default'],
    'data-dismiss' =&gt; 'modal',
  )
);


If you need a button type='button' just to fire Javascript and not submit the form, that is somewhat problematic, it seems. One method is to override the button template.

Type inline_template may be the best bet:

$form['submit_container']['button'] = array(
  '#type' =&gt; 'inline_template',
  '#template' =&gt; '&lt;button type="button" class="btn btn-sm btn-default" data-dismiss="modal" onclick="closeButton()"&gt;Close&lt;/button&gt;',
);


Change a normal submit &#39;input&#39; type to &#39;button&#39; type with button tag