The Table component is used to display a list of structured information. Each line represent an item in the list, and a cell represent a property/piece of information of this item.
Responsive
Responsive define if the table need to get a vertical display when on small screen (<640px).
In order to accomplish the table heading for each line on small screen, we need to add on each cell a data-table-heading attributes.
Type | Default Value |
---|
boolean | false |
Firstname |
Lastname |
Email |
ZipCode |
John |
Smith |
john.smith@gmail.com |
1000 |
Jean |
Moulin |
jean.moulin@gmail.com |
1200 |
Bart |
Simpson |
bart.simpson@gmail.com |
1180 |
<NVTable Responsive>
<NVTableHead>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>ZipCode</th>
</NVTableHead>
<NVTableBody>
<tr>
<td data-table-heading="Firstname">John</td>
<td data-table-heading="Lastname">Smith</td>
<td data-table-heading="Email" class="text-gray-800">john.smith@gmail.com</td>
<td data-table-heading="ZipCode">1000</td>
</tr>
<tr>
<td data-table-heading="Firstname">Jean</td>
<td data-table-heading="Lastname">Moulin</td>
<td data-table-heading="Email" class="text-gray-800">jean.moulin@gmail.com</td>
<td data-table-heading="ZipCode">1200</td>
</tr>
<tr>
<td data-table-heading="Firstname">Bart</td>
<td data-table-heading="Lastname">Simpson</td>
<td data-table-heading="Email" class="text-gray-800">bart.simpson@gmail.com</td>
<td data-table-heading="ZipCode">1180</td>
</tr>
</NVTableBody>
</NVTable>
<div class="nv-table nv-table-responsive">
<table>
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>ZipCode</th>
</tr>
</thead>
<tbody>
<tr>
<td data-table-heading="Firstname">John</td>
<td data-table-heading="Lastname">Smith</td>
<td data-table-heading="Email" class="text-gray-800">john.smith@gmail.com</td>
<td data-table-heading="ZipCode">1000</td>
</tr>
<tr>
<td data-table-heading="Firstname">Jean</td>
<td data-table-heading="Lastname">Moulin</td>
<td data-table-heading="Email" class="text-gray-800">jean.moulin@gmail.com</td>
<td data-table-heading="ZipCode">1200</td>
</tr>
<tr>
<td data-table-heading="Firstname">Bart</td>
<td data-table-heading="Lastname">Simpson</td>
<td data-table-heading="Email" class="text-gray-800">bart.simpson@gmail.com</td>
<td data-table-heading="ZipCode">1180</td>
</tr>
</tbody>
</table>
</div>
<nv-table responsive>
<nv-tablerow slot="header">
<nv-tablecell grid-cols="6">Firstname</nv-tablecell>
<nv-tablecell grid-cols="6">Lastname</nv-tablecell>
<nv-tablecell grid-cols="6">Email</nv-tablecell>
<nv-tablecell grid-cols="6">ZipCode</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">John</nv-tablecell>
<nv-tablecell grid-cols="6">Smith</nv-tablecell>
<nv-tablecell grid-cols="6">john.smith@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1000</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">Jean</nv-tablecell>
<nv-tablecell grid-cols="6">Moulin</nv-tablecell>
<nv-tablecell grid-cols="6">jean.moulin@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1200</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">Bart</nv-tablecell>
<nv-tablecell grid-cols="6">Simpson</nv-tablecell>
<nv-tablecell grid-cols="6">bart.simpson@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1180</nv-tablecell>
</nv-tablerow>
</nv-table>
<NvTable responsive>
<NvTableRow slot="header">
<NvTableCell grid-cols="6"> Firstname </NvTableCell>
<NvTableCell grid-cols="6"> Lastname </NvTableCell>
<NvTableCell grid-cols="6"> Email </NvTableCell>
<NvTableCell grid-cols="6"> ZipCode </NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6"> John </NvTableCell>
<NvTableCell grid-cols="6"> Smith </NvTableCell>
<NvTableCell grid-cols="6"> john.smith@gmail.com </NvTableCell>
<NvTableCell grid-cols="6"> 1000 </NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6"> Jean </NvTableCell>
<NvTableCell grid-cols="6"> Moulin </NvTableCell>
<NvTableCell grid-cols="6"> jean.moulin@gmail.com </NvTableCell>
<NvTableCell grid-cols="6"> 1200 </NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6"> Bart </NvTableCell>
<NvTableCell grid-cols="6"> Simpson </NvTableCell>
<NvTableCell grid-cols="6"> bart.simpson@gmail.com </NvTableCell>
<NvTableCell grid-cols="6"> 1180 </NvTableCell>
</NvTableRow>
</NvTable>
Striped
Striped define if the table need to display a alternate color for each line of the table.
Type | Default Value |
---|
boolean | false |
Firstname |
Lastname |
Email |
ZipCode |
John |
Smith |
john.smith@gmail.com |
1000 |
Jean |
Moulin |
jean.moulin@gmail.com |
1200 |
Bart |
Simpson |
bart.simpson@gmail.com |
1180 |
<NVTable Striped>
<NVTableHead>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>ZipCode</th>
</NVTableHead>
<NVTableBody>
<tr>
<td>John</td>
<td>Smith</td>
<td class="text-gray-800">john.smith@gmail.com</td>
<td>1000</td>
</tr>
<tr>
<td>Jean</td>
<td>Moulin</td>
<td class="text-gray-800">jean.moulin@gmail.com</td>
<td>1200</td>
</tr>
<tr>
<td>Bart</td>
<td>Simpson</td>
<td class="text-gray-800">bart.simpson@gmail.com</td>
<td>1180</td>
</tr>
</NVTableBody>
</NVTable>
<div class="nv-table nv-table-striped">
<table>
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>ZipCode</th>
</tr>
</thead>
<tbody>
<tr>
<td>John</td>
<td>Smith</td>
<td class="text-gray-800">john.smith@gmail.com</td>
<td>1000</td>
</tr>
<tr>
<td>Jean</td>
<td>Moulin</td>
<td class="text-gray-800">jean.moulin@gmail.com</td>
<td>1200</td>
</tr>
<tr>
<td>Bart</td>
<td>Simpson</td>
<td class="text-gray-800">bart.simpson@gmail.com</td>
<td>1180</td>
</tr>
</tbody>
</table>
</div>
<nv-table striped>
<nv-tablerow slot="header">
<nv-tablecell grid-cols="6">Firstname</nv-tablecell>
<nv-tablecell grid-cols="6">Lastname</nv-tablecell>
<nv-tablecell grid-cols="6">Email</nv-tablecell>
<nv-tablecell grid-cols="6">ZipCode</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">John</nv-tablecell>
<nv-tablecell grid-cols="6">Smith</nv-tablecell>
<nv-tablecell grid-cols="6">john.smith@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1000</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">Jean</nv-tablecell>
<nv-tablecell grid-cols="6">Moulin</nv-tablecell>
<nv-tablecell grid-cols="6">jean.moulin@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1200</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">Bart</nv-tablecell>
<nv-tablecell grid-cols="6">Simpson</nv-tablecell>
<nv-tablecell grid-cols="6">bart.simpson@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1180</nv-tablecell>
</nv-tablerow>
</nv-table>
<NvTable striped>
<NvTableRow slot="header">
<NvTableCell grid-cols="6"> Firstname </NvTableCell>
<NvTableCell grid-cols="6"> Lastname </NvTableCell>
<NvTableCell grid-cols="6"> Email </NvTableCell>
<NvTableCell grid-cols="6"> ZipCode </NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6"> John </NvTableCell>
<NvTableCell grid-cols="6"> Smith </NvTableCell>
<NvTableCell grid-cols="6"> john.smith@gmail.com </NvTableCell>
<NvTableCell grid-cols="6"> 1000 </NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6"> Jean </NvTableCell>
<NvTableCell grid-cols="6"> Moulin </NvTableCell>
<NvTableCell grid-cols="6"> jean.moulin@gmail.com </NvTableCell>
<NvTableCell grid-cols="6"> 1200 </NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6"> Bart </NvTableCell>
<NvTableCell grid-cols="6"> Simpson </NvTableCell>
<NvTableCell grid-cols="6"> bart.simpson@gmail.com </NvTableCell>
<NvTableCell grid-cols="6"> 1180 </NvTableCell>
</NvTableRow>
</NvTable>
NVTableBody
RenderFragment used to put body line and body cell in the table.
Type | Default Value |
---|
RenderFragment | null |
John |
Smith |
john.smith@gmail.com |
1000 |
Jean |
Moulin |
jean.moulin@gmail.com |
1200 |
Bart |
Simpson |
bart.simpson@gmail.com |
1180 |
<NVTable>
<NVTableBody>
<tr>
<td>John</td>
<td>Smith</td>
<td class="text-gray-800">john.smith@gmail.com</td>
<td>1000</td>
</tr>
<tr>
<td>Jean</td>
<td>Moulin</td>
<td class="text-gray-800">jean.moulin@gmail.com</td>
<td>1200</td>
</tr>
<tr>
<td>Bart</td>
<td>Simpson</td>
<td class="text-gray-800">bart.simpson@gmail.com</td>
<td>1180</td>
</tr>
</NVTableBody>
</NVTable>
<div class="nv-table">
<table>
<tbody>
<tr>
<td>John</td>
<td>Smith</td>
<td class="text-gray-800">john.smith@gmail.com</td>
<td>1000</td>
</tr>
<tr>
<td>Jean</td>
<td>Moulin</td>
<td class="text-gray-800">jean.moulin@gmail.com</td>
<td>1200</td>
</tr>
<tr>
<td>Bart</td>
<td>Simpson</td>
<td class="text-gray-800">bart.simpson@gmail.com</td>
<td>1180</td>
</tr>
</tbody>
</table>
</div>
<nv-table>
<nv-tablerow>
<nv-tablecell grid-cols="6">John</nv-tablecell>
<nv-tablecell grid-cols="6">Smith</nv-tablecell>
<nv-tablecell grid-cols="6">john.smith@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1000</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">Jean</nv-tablecell>
<nv-tablecell grid-cols="6">Moulin</nv-tablecell>
<nv-tablecell grid-cols="6">jean.moulin@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1200</nv-tablecell>
</nv-tablerow>
<nv-tablerow>
<nv-tablecell grid-cols="6">Bart</nv-tablecell>
<nv-tablecell grid-cols="6">Simpson</nv-tablecell>
<nv-tablecell grid-cols="6">bart.simpson@gmail.com</nv-tablecell>
<nv-tablecell grid-cols="6">1180</nv-tablecell>
</nv-tablerow>
</nv-table>
<NvTable>
<NvTableRow>
<NvTableCell grid-cols="6">John</NvTableCell>
<NvTableCell grid-cols="6">Smith</NvTableCell>
<NvTableCell grid-cols="6">john.smith@gmail.com</NvTableCell>
<NvTableCell grid-cols="6">1000</NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6">Jean</NvTableCell>
<NvTableCell grid-cols="6">Moulin</NvTableCell>
<NvTableCell grid-cols="6">jean.moulin@gmail.com</NvTableCell>
<NvTableCell grid-cols="6">1200</NvTableCell>
</NvTableRow>
<NvTableRow>
<NvTableCell grid-cols="6">Bart</NvTableCell>
<NvTableCell grid-cols="6">Simpson</NvTableCell>
<NvTableCell grid-cols="6">bart.simpson@gmail.com</NvTableCell>
<NvTableCell grid-cols="6">1180</NvTableCell>
</NvTableRow>
</NvTable>
NVTableHead
RenderFragment used to put heading line and heading cell in the table.
Type | Default Value |
---|
RenderFragment | null |
Firstname |
Lastname |
Email |
ZipCode |
<NVTable>
<NVTableHead>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>ZipCode</th>
</NVTableHead>
</NVTable>
<div class="nv-table">
<table>
<thead>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Email</th>
<th>ZipCode</th>
</tr>
</thead>
</table>
</div>
<nv-table striped="true">
<nv-tablerow slot="header">
<nv-tablecell grid-cols="6">Firstname</nv-tablecell>
<nv-tablecell grid-cols="6">Lastname</nv-tablecell>
<nv-tablecell grid-cols="6">Email</nv-tablecell>
<nv-tablecell grid-cols="6">ZipCode</nv-tablecell>
</nv-tablerow>
</nv-table>
<NvTable>
<NvTableRow slot="header">
<NvTableCell grid-cols="6">Firstname</NvTableCell>
<NvTableCell grid-cols="6">Lastname</NvTableCell>
<NvTableCell grid-cols="6">Email</NvTableCell>
<NvTableCell grid-cols="6">ZipCode</NvTableCell>
</NvTableRow>
</NvTable>