ComponentsComplex
Data Table
Enterprise-grade data table with sorting, filtering, pagination, and row actions
The Data Table component provides comprehensive table functionality inspired by Airtable, including multi-column sorting, search, pagination, row selection, and export capabilities.
Basic Usage
Simple Table
With All Features
Full Featured Table
Schema
interface TableColumn {
header: string; // Column header text
accessorKey: string; // Data property key
width?: string; // Column width (e.g., '100px', '20%')
sortable?: boolean; // Enable sorting for this column
}
interface DataTableSchema {
type: 'data-table';
// Structure
columns: TableColumn[]; // Column definitions
data: Record<string, any>[]; // Table data
caption?: string; // Table caption
// Features
pagination?: boolean; // Enable pagination (default: true)
pageSize?: number; // Items per page (default: 10)
searchable?: boolean; // Enable search (default: true)
selectable?: boolean; // Enable row selection (default: false)
sortable?: boolean; // Enable sorting (default: true)
exportable?: boolean; // Enable CSV export (default: false)
rowActions?: boolean; // Show edit/delete buttons (default: false)
// Advanced features
resizableColumns?: boolean; // Allow column resizing (default: true)
reorderableColumns?: boolean; // Allow column reordering (default: true)
// Styling
className?: string; // Tailwind CSS classes
// Base properties
id?: string;
visible?: boolean | string;
testId?: string;
}Examples
Product Inventory
Inventory Management
User Management
User Table
Sales Report
Sales Data
Features
The Data Table component provides:
- Sorting: Click column headers to sort (ascending/descending/none)
- Search: Real-time search across all columns
- Pagination: Navigate through large datasets
- Selection: Select multiple rows with checkboxes
- Export: Download table data as CSV
- Row Actions: Built-in edit and delete buttons
- Resizable Columns: Drag column borders to resize
- Column Reordering: Drag columns to reorder