tableselect form doesn't work
Found the issue: the #type' => 'tableselect has to be built inside a class that extends FormBase.

This Works:

  class DisplayTable_1 extends FormBase {
    public function buildForm(array $form, FormStateInterface $form_state)
    {
        $options = [
            1 =&gt; ['first_name' =&gt; 'Indy', 'last_name' =&gt; 'Jones'],
            2 =&gt; ['first_name' =&gt; 'Darth', 'last_name' =&gt; 'Vader'],
            3 =&gt; ['first_name' =&gt; 'Super', 'last_name' =&gt; 'Man'],
        ];

        $header = [
            'first_name' =&gt; t('First Name'),
            'last_name' =&gt; t('Last Name'),
        ];

        $form['table'] = [
            '#type' =&gt; 'tableselect',
            '#title' =&gt; $this-&gt;t('Users'),
            '#header' =&gt; $header,
            '#options' =&gt; $options,
            '#empty' =&gt; t('No users found'),
        ];

        // Add a submit button that handles the submission of the form.
        $form['actions']['submit'] = [
            '#type' =&gt; 'submit',
            '#value' =&gt; $this-&gt;t('Submit'),
            '#description' =&gt; $this-&gt;t('Submit, #type = submit'),
        ];
        return $form;
    }

    public function getFormId() {
        return 'fapi_example_input_demo_form';
    }

    public function submitForm(array &amp;$form, FormStateInterface $form_state) {
        // Find out what was submitted.
        $values = $form_state-&gt;getValues();
        foreach ($values as $key =&gt; $value) {
            $label = isset($form[$key]['#title']) ? $form[$key]['#title'] : $key;

            // Many arrays return 0 for unselected values so lets filter that out.
            if (is_array($value)) {
                $value = array_filter($value);
            }

            // Only display for controls that have titles and values.
            if ($value &amp;&amp; $label) {
                $display_value = is_array($value) ? preg_replace('/[\n\r\s]+/', ' ', print_r($value, 1)) : $value;
                $message = $this-&gt;t('Value for %title: %value', array('%title' =&gt; $label, '%value' =&gt; $display_value));
                drupal_set_message($message);
            }
        }
    }
}