Checkboxes in a simple form are not displayed I have a simple form in a custom module that works well and is displaying my select as it should.

$form = \Drupal::formBuilder()-&gt;getForm('Drupal\efq\Form\FilterForm');
$form["container"] =  array(
    'categories' =&gt; array(
        '#title' =&gt; t('Select a Category'),
        '#type' =&gt; 'select',
        '#options' =&gt;  array(
            1 =&gt; t('Option 1'),
            2 =&gt; t('Option 2'),
            3 =&gt; t('Option 3'),
        )
    )
);


I would like to change Select for Checkboxes. According to this, "Checkboxes" structure is the same as per "Select".
But when I change '#type' =&gt; 'select' for '#type' =&gt; 'checkboxes' there are no checkboxes created and I got the 2 following warnings:

Notice: Undefined index: #title_display in Drupal\Core\Render\Element\Checkboxes::preRenderCompositeFormElement() (line 20 of core/lib/Drupal/Core/Render/Element/CompositeFormElementTrait.php).
Notice: Undefined index: #id in Drupal\Core\Render\Element\Checkboxes::preRenderCompositeFormElement() (line 30 of core/lib/Drupal/Core/Render/Element/CompositeFormElementTrait.php).


Adding these in an array makes the notice messages disappear but the checkboxes are still not showing.

Any idea of what's going on ?
You code works for me. I used the exact following code and got checkboxes in my form using Drupal 8.3.4:

$form['container'] = [
  'categories' =&gt; [
    '#title' =&gt; t('Select a Category'),
    '#type' =&gt; 'checkboxes',
    '#options' =&gt; [
      1 =&gt; t('Option 1'),
      2 =&gt; t('Option 2'),
      3 =&gt; t('Option 3'),
    ],
  ],
];

return $form;