-
Notifications
You must be signed in to change notification settings - Fork 1
Table
Lenny P. edited this page May 17, 2025
·
1 revision
The Table component provides a fully styled, responsive HTML table with support for headers, body rows, and cells. It includes optional row striping and consistent styling for dark mode and accessibility.
<x-table>
<x-table.header>
<x-table.header.item>
Header 1
</x-table.header.item>
<x-table.header.item>
Header 2
</x-table.header.item>
</x-table.header>
<x-table.body>
<x-table.body.row>
<x-table.body.item>
Row 1, Cell 1
</x-table.body.item>
<x-table.body.item>
Row 1, Cell 2
</x-table.body.item>
</x-table.body.row>
<x-table.body.row>
<x-table.body.item>
Row 2, Cell 1
</x-table.body.item>
<x-table.body.item>
Row 2, Cell 2
</x-table.body.item>
</x-table.body.row>
</x-table.body>
</x-table>- No explicit props; accepts standard HTML attributes applied to the outer container and
<table>element.
- No explicit props; accepts attributes applied to the
<thead>element.
- No explicit props; renders a
<th>with padding and scope="col".
- No explicit props; accepts attributes applied to the
<tbody>element.
-
striped(bool, default: true)
Enables alternating row background colors for better readability.
- No explicit props; renders a padded
<td>element.
This Table component simplifies building accessible, styled tables with Tailwind CSS. It wraps the table in a responsive container with overflow support and border styling. The header, body, rows, and cells are modular components for easy customization. Optional striped rows enhance row distinction, and dark mode styles ensure consistent appearance across themes.