Embed controls 8 #table element? I'm using the Drupal 8 #table element to populate a table on my form, and it's working great for displaying static data.

foreach ($entries = getData() as $entry) {
  $row = array_map('Drupal\Component\Utility\SafeMarkup::checkPlain', $entry);
  $rows[] = $row;
}
$form['table'] = array(
  '#type' =&gt; 'table',
  '#header' =&gt; $headers,
  '#rows' =&gt; $rows,
  '#attributes' =&gt; array('id' =&gt; 'my-module-list'),
  '#empty' =&gt; t('No entries available.'),
);


However, I would like to embed a control in each row of the table, for example:

foreach ($entries = getData() as $entry) {
  $row = array_map('Drupal\Component\Utility\SafeMarkup::checkPlain', $entry);
  $row["field_name"] = array(
    '#type' =&gt; 'textbox',
  );
  $rows[] = $row;
}
//dpm($rows);
$form['table'] = array(
  '#type' =&gt; 'table',
  '#header' =&gt; $headers,
  '#rows' =&gt; $rows,
  '#attributes' =&gt; array('id' =&gt; 'my-module-list'),
  '#empty' =&gt; t('No entries available.'),
);  


However, the #textbox field is currently being ignored, and an empty cell is shown in its place.

Is there a way I can embed fields in a Drupal generated table, or do I need to build my own table from scratch?
It is no problem to put form elements in a table. See the example in core/lib/Drupal/Core/Render/Element/Table.php:

$form['contacts'] = array(
    '#type' =&gt; 'table',
    '#title' =&gt; 'Sample Table',
    '#header' =&gt; array('Name', 'Phone'),
  );

  for ($i=1; $i&lt;=4; $i++) {
    $form['contacts'][$i]['name'] = array(
      '#type' =&gt; 'textfield',
      '#title' =&gt; t('Name'),
      '#title_display' =&gt; 'invisible',
    );

    $form['contacts'][$i]['phone'] = array(
      '#type' =&gt; 'tel',
      '#title' =&gt; t('Phone'),
      '#title_display' =&gt; 'invisible',
    );
  }


Maybe you should start from here and then put step by step your code in this example and see when it breaks.