Table
usePreParser
hook should be used to fetch all rows of the table.
The backbone
of tetra-pack is actually the implementation of table. Tetra-pack divides tables into most basic html tags.
All the tags are mentioned below.
Pre-Defined Syntax
blocks: {
table: (text, key) => <table key={key}>{text}</table>,
table_cell: (text, key) => <td key={key}>{text}</td>,
table_row: (text, key) => <tr key={key}>{text}</tr>,
table_header_cell: (text, key) => <th key={key}>{text}</th>,
table_head: (text, key) => <thead key={key}>{text}</thead>,
table_body: (text, key) => <tbody key={key}>{text}</tbody>,
}
Table Anatomy
Basic table structure looks like:
<table>
// table head
<thead>
<tr>
<th>wrestler</th>
<th>origin</th>
<th>finisher</th>
</tr>
</thead>
// table body
<tbody>
<tr>
<td>Randy Ortan</td>
<td>Texas</td>
<td>RKO</td>
</tr>
<tr>
<td>Steve Cold Austin</td>
<td>Austin</td>
<td>Stone Cold Stunner</td>
</tr>
</tbody>
</table>
All the elements used to construct a table include,
-
Table Wrapper
The wrapper tag for all the rows. It is the basic<table />
tag.table: (text, key) => <table key={key}>{text}</table>,
-
Table Simple Cell
All the data, i.e. the table cells except header cells, are wrapped inside basic<td />
tag.table_cell: (text, key) => <td key={key}>{text}</td>,
-
Table Header Cell
The data for header row or column is wrapped inside<th />
tag.table_header_cell: (text, key) => <th key={key}>{text}</th>,
-
Table Row
All the cells of a simple table row are wrapped inside<tr />
tag.table_row: (text, key) => <tr key={key}>{text}</tr>,
-
Table Head
The Header row of the table is wrapped inside<thead />
tag.table_header_cell: (text, key) => <th key={key}>{text}</th>,
-
Table Body
All the rows except header row are clubbed together and wrapped inside<tbody />
tag.table_header_cell: (text, key) => <th key={key}>{text}</th>,