ObjectUIObjectUI
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

ID
Name
Email
Status
1
John Doe
john@example.com
Active
2
Jane Smith
jane@example.com
Active
3
Bob Johnson
bob@example.com
Inactive

With All Features

Full Featured Table

ID
Name
Role
Department
Status
Actions
1
Alice Brown
Manager
Sales
Active
2
Bob Wilson
Developer
Engineering
Active
3
Carol Davis
Designer
Design
Active
4
David Lee
Developer
Engineering
Inactive
5
Eve Martinez
Manager
Marketing
Active
Rows per page:
Page 1 of 2

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

Product Inventory
SKU
Product
Category
Stock
Price
PRD-001
Laptop Pro
Electronics
45
$1,299
PRD-002
Wireless Mouse
Accessories
120
$29
PRD-003
USB-C Cable
Accessories
200
$15
PRD-004
Monitor 27"
Electronics
30
$399
PRD-005
Keyboard
Accessories
80
$79
Rows per page:
Page 1 of 2

User Management

User Table

User
Email
Role
Last Login
Actions
John Doe
john@company.com
Admin
Jan 20, 2024
Jane Smith
jane@company.com
Editor
Jan 19, 2024
Bob Wilson
bob@company.com
Viewer
Jan 18, 2024
Alice Brown
alice@company.com
Editor
Jan 17, 2024
Rows per page:
Page 1 of 2

Sales Report

Sales Data

Q1 Sales Report
Month
Revenue
Orders
Avg Order
Growth
January
$124,500
842
$148
+12%
February
$135,200
923
$147
+8.6%
March
$148,900
1,015
$147
+10.1%

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

On this page