Bootstrap progress bar missing style option
#markup filters the style option because of the xss filter.

Use an inline template instead:

$form['pr_bar'] = [
  '#type' =&gt; 'inline_template',
  '#template' =&gt; '
    &lt;div class="progress"&gt;
      &lt;div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="{{ complete }}"
      aria-valuemin="0" aria-valuemax="100" style="width:{{ complete }}%"&gt;
        {{ complete }}% Complete (success)
      &lt;/div&gt;
    &lt;/div&gt;',
  '#context' =&gt; [
    'complete' =&gt; '40',
  ],
];


You can pass the percentage value as twig variable.