Virtualized Body 🚀
A high-performance table body component that efficiently renders large datasets through virtualization
Virtualized Body 🚀
The VirtualizedBody
component is a performance-optimized version of the table body that only renders visible rows, making it perfect for handling large datasets efficiently. It uses virtualization techniques to maintain smooth scrolling and responsive performance.
Features ✨
- 🎯 Virtual scrolling for large datasets
- 📏 Fixed and dynamic row heights
- 🔄 Infinite scrolling support
- ⚡ Optimized performance
- 🎨 Customizable styling
- ♿ Full accessibility support
- 📱 Touch device support
Basic Usage
Props
Required Props
tableInstance
The table instance from useTableGrid hook that manages the table state.
config
Configuration object for virtualization settings.
Optional Props
className
Add custom CSS classes to the virtualized body container.
bodyRowClassName
Add custom CSS classes to all virtualized rows.
bodyCellClassName
Add custom CSS classes to all cells in virtualized rows.
style
Add custom inline styles to the container.
withoutTailwind
Use without Tailwind CSS styling.
- Type:
boolean
- Default:
false
customRender
Custom render functions for rows and loading state.
components
Component overrides for loading state.
Features
Scrolling to Specific Rows
Use the ref to programmatically scroll to specific rows:
Infinite Loading
Implement infinite scrolling with the onEndReached
callback:
Dynamic Row Heights
Support varying row heights with a height calculation function:
Styling
With Tailwind (Default)
Without Tailwind
Loading States
The component handles loading states automatically:
Accessibility ♿
The VirtualizedBody component implements these accessibility features:
role="rowgroup"
for the containerrole="presentation"
for virtualized contentaria-label
for clear contextaria-busy
during loading statesaria-live
for dynamic content updates- Touch device support with smooth scrolling
Best Practices 💡
- Set appropriate row heights for your content
- Use reasonable overscan values (3-10 rows)
- Implement loading states for better UX
- Handle scroll performance with debouncing
- Consider window resize events
- Test with different data sizes
- Maintain accessibility features
Integration with TableGrid
The VirtualizedBody is typically used within the TableGrid component:
Related Components
Last updated on