Documentation Index
Fetch the complete documentation index at: https://mintlify.com/RtlZeroMemory/Rezi/llms.txt
Use this file to discover all available pages before exploring further.
Data Table Implementation
Patterns for building interactive data tables with sorting, filtering, selection, and virtual scrolling.Problem
You need to display tabular data with:- Column-based sorting
- Client-side filtering
- Row selection (single/multi)
- Virtual scrolling for large datasets
- Custom cell rendering
Solution
Useui.table() widget with state-managed sorting, filtering, and selection.
Basic Table with Sorting & Selection
Column Configuration
Fixed and Flex Widths
Column Constraints
Text Overflow Handling
Cell Alignment
Custom Cell Rendering
Render Function
Row-Based Rendering
Selection Modes
Single Selection
Multi Selection with Keyboard Modifiers
- Click - Select only clicked row
- Ctrl+Click - Toggle row selection
- Shift+Click - Select range from last clicked to current
No Selection
Sorting
Declarative Sorting
Sort Cycle
Clicking a sortable header cycles through:- Unsorted → Ascending
- Ascending → Descending
- Descending → Ascending (cycles back)
useTable Hook: Integrated State Management
For simpler table state wiring, use theuseTable hook:
- Auto-manages selection state
- Auto-manages sort state
- Auto-sorts data
- Provides helper methods (
clearSelection,setSort)
Virtual Scrolling for Large Datasets
For tables with 1000+ rows, useui.virtualList() with custom row rendering:
- Renders only visible rows
- Handles 100k+ items efficiently
- Smooth scrolling via keyboard/mouse
- Automatic scroll position management
Filtering Patterns
Client-Side Text Filter
Multi-Column Filters
Pagination
Styling
Striped Rows
Border Style
Best Practices
- Always provide
getRowKey- Stable keys prevent state loss during updates - Filter before sort - More efficient pipeline
- Use virtual scrolling for 1000+ rows - Prevents render bottlenecks
- Debounce filter inputs - Reduce re-renders during typing
- Show loading state - Use
ui.skeleton()orui.spinner()during data fetch - Handle empty state - Use
ui.empty()when no data or no results - Memoize sorted/filtered data - Avoid recomputing on every render
- Use
useTablefor common patterns - Reduces state management boilerplate - Provide visual feedback for selection - Use
stripedRowsor highlight selected - Keep column config readable - Extract to constants for large tables
Related
- Virtual List Widget - Efficient list rendering
- Pagination Widget - Page navigation
- Loading States Recipe - Async data patterns
- Keyboard Shortcuts Recipe - Table navigation