Each HTML table element has a corresponding class representation in Table Generator. These classes provide an object-oriented way to construct and manipulate table structures programmatically.
Table Row (Tr)
The Tr class represents a <tr> (table row) element.
use Ucscode\HtmlComponent\TableGenerator\Component\Section\Tr;
$tr = new Tr();
Table Header (Th)
The Th class represents a <th> (table header cell) element.
use Ucscode\HtmlComponent\TableGenerator\Component\Section\Th;
$th = new Th("Header");
Table Data (Td)
The Td class represents a <td> (table data cell) element.
use Ucscode\HtmlComponent\TableGenerator\Component\Section\Td;
$td = new Td("Data");
Table Head (Thead)
The Thead class represents a <thead> element, which groups header rows in a table.
use Ucscode\HtmlComponent\TableGenerator\Component\Section\Thead;
$thead = new Thead();
Table Body (Tbody)
The Tbody class represents a <tbody> element, which groups body rows in a table.
use Ucscode\HtmlComponent\TableGenerator\Component\Section\Tbody;
$tbody = new Tbody();
Table Footer (Tfoot)
The Tfoot class represents a <tfoot> element, which groups footer rows in a table.
use Ucscode\HtmlComponent\TableGenerator\Component\Section\Tfoot;
$tfoot = new Tfoot();
Column (Col)
The Col class represents a <col> element, used to apply styles to entire columns.
use Ucscode\HtmlComponent\TableGenerator\Component\Col;
$col = new Col();
Column Group (ColGroup)
The ColGroup class represents a <colgroup> element, grouping multiple <col> elements together.
use Ucscode\HtmlComponent\TableGenerator\Component\ColGroup;
$colGroup = new ColGroup();
Caption (Caption)
The Caption class represents a <caption> element, which provides a title for the table.
use Ucscode\HtmlComponent\TableGenerator\Component\Caption;
$caption = new Caption("Table Title");
Each of these classes provides methods for setting attributes, adding child elements, and rendering the corresponding HTML structure.