Table
The Table component provides a flexible way to display tabular data with support for dividers, rounded borders, and striped rows.Installation
Usage
Table Variants
With Dividers
Render table with visible borders between cells:Rounded Borders
Apply rounded corners to the table:Striped Rows
Alternate row background colors for better readability:Composition Pattern
The Table component is designed to work with several subcomponents:Table with Selection
Props
Table
If
true, the table will be rendered with dividers between cells.If
true, the table will be rendered with rounded borders.If
true, the table will be rendered with alternating row colors.TableCell
Set the text alignment for the cell content.
The content of the cell.
TableRow
If
true, the row will be styled as selected.Callback fired when the row is clicked.
Subcomponents
- TableContainer: Wrapper component providing scrolling behavior
- TableHead: Groups header rows
- TableBody: Groups body rows
- TableFooter: Groups footer rows
- TableRow: Represents a single row
- TableCell: Represents a single cell
- TablePagination: Adds pagination controls
- TableSortLabel: Adds sorting functionality to headers
Best Practices
- Always wrap Table in a TableContainer for proper scrolling behavior
- Use TableHead to clearly separate headers from body content
- Keep cell content concise for better readability
- Use striped rows for tables with many rows
- Consider adding dividers for complex tables with many columns
Accessibility
- Table automatically uses semantic HTML table elements
- Ensure header cells are properly marked in TableHead
- Provide meaningful labels for interactive elements
- Use proper color contrast for striped rows
Related Components
- Checkbox - For row selection
- IconButton - For action buttons in cells

