Table Row
Documentation for the table row component in React Table Grid
Table Row 📑
The TableRow
component renders individual rows in your table. It handles row interactions, cell rendering, and supports features like row selection and pinned columns.
Features 🎯
- 🔍 Row selection with keyboard support
- 📌 Support for pinned columns
- 🎨 Custom cell rendering
- 📱 Responsive design
- ♿ Full accessibility support
- 🖱️ Interactive row events
Basic Usage
Here's a simple example of how to use TableRow:
Props
Required Props
tableInstance
The table instance from useTableGrid hook.
row
The data for this row.
rowIndex
The index of this row in the table.
Optional Props
className
Add custom CSS classes to the row.
cellClassName
Add custom CSS classes to all cells in the row.
style
Add custom inline styles.
components
Custom component overrides.
withoutTailwind
Use without Tailwind CSS.
- Type:
boolean
- Default:
false
isSelected
Whether the row is selected.
- Type:
boolean
- Default:
false
Advanced Features
1. Row Selection
Handle row selection with keyboard support:
2. Custom Cell Rendering
Customize how cells are rendered:
3. Pinned Columns
Support for pinned columns with proper styling:
4. Virtual Scrolling Support
For use with virtualized tables:
Styling Guide
With Tailwind (Default)
Without Tailwind
Examples
Basic Row with Selection
Row with Custom Cells and Pinning
Accessibility ♿
The TableRow component includes these accessibility features:
role="row"
: Identifies the element as a table rowaria-rowindex
: Provides the row's position in the table- Keyboard navigation support (Enter/Space for selection)
- Proper tabIndex management
- Interactive elements properly labeled
Best Practices 💡
- Handle Selection: Implement clear visual feedback for selection
- Keyboard Navigation: Test and ensure keyboard navigation works
- Custom Rendering: Keep custom cell renders performant
- Consistent Heights: Maintain consistent row heights
- Mobile Support: Ensure rows work well on small screens
- Virtual Scrolling: Use virtual rows for large datasets
- Accessibility: Maintain ARIA attributes and keyboard support
Related Components
Last updated on