How do I add a CSS class to a form label? I want to add a CSS class to a label on a page that is using Drupal 8 Form API.  I have been unable to find a reference online on how to apply that.
I have used the following workaround, but it produces some strange results.

public function buildForm(array $form, FormStateInterface $form_state)
{
    $form['label1']  = array(
        '#type' =&gt; 'label',
        '#title' =&gt; $this-&gt;t('QUESTIONNAIRE'),
        '#id'         =&gt; 'lbl1',
        '#prefix'     =&gt; '&lt;div class="caption1"&gt;',
        '#suffix'     =&gt; '&lt;/div&gt;',
    ) ;


and the HTML rendered is:

&lt;div class="caption1"&gt;&lt;label for="lbl1" class="control-label"&gt;
&lt;div class="caption1"&gt;&lt;/div&gt;QUESTIONNAIRE
  &lt;/label&gt;


Not only is the div statement in the wrong place but it is rendered twice.

I had found postings from several years ago that show this was not possible, but I am hoping that since then, and with D8, it has been fixed.
I do not want to do it with prefix/suffix, but as a separate array element.

PS: this site is Drupal 8.0.0-rc2
I know this is an old thread, but for anyone Googling.

The clue to this is in template_preprocess_form_element().

$element += [
    '#title_display' =&gt; 'before',
    '#wrapper_attributes' =&gt; [],
    '#label_attributes' =&gt; [],
  ];


#label_attributes is a standard attribute array, so very easy to set a class with ['class' =&gt; ['my-class', 'other-class']]

#title_display takes 3 values:


before: The label is output before the element. This is the default.
after: The label is output after the element. For example, this is used for radio and checkbox #type elements. 
invisible: Labels are critical for screen readers to enable them to properly navigate through forms but can be visually distracting. This property hides the label for everyone except screen readers.
attribute: Set the title attribute on the element to create a tooltip but output no label element. This is supported only for checkboxes and radios