Bootstrap progress bar missing style option Drupal 8 using Bootstrap theme. I am trying to create a progress bar on my form. I have done it in a block with no problem but in the form it loses the "style" option and displays a blank progress bar.

I put in this:

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


and get a blank bar. When i inspect element:

&lt;div class="progress"&gt;
    &lt;div class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="40" aria-valuemin="0" aria-valuemax="100"&gt;&lt;span class="sr-only"&gt;40% Complete (success)&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;


Why is the style option missing and is this causing the blank bar?
#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.