Table

class Table

Provides a render element for a table.

Note: Although this extends FormElement, it can be used outside the context of a form.

Properties:

  • #header: An array of table header labels.
  • #rows: An array of the rows to be displayed. Each row is either an array of cell contents or an array of properties as described in table.html.twig Alternatively specify the data for the table as child elements of the table element. Table elements would contain rows elements that would in turn contain column elements.
  • #empty: Text to display when no rows are present.
  • #responsive: Indicates whether to add the drupal.responsive_table library providing responsive tables. Defaults to TR