Skip to main content
Created: 2026-01-08
Status: Complete
Task: T17

Overview

This guide provides step-by-step instructions for migrating existing table implementations to the new @/platform/table DataTable framework.

Quick Start

1. Add Imports

2. Define Columns

3. Use the Hook

4. Render Components


Migration Patterns

Pattern 1: Basic Table with Loading/Empty States

BEFORE:
AFTER:

Pattern 2: Table with Search and Filters

BEFORE:
AFTER:

Pattern 3: Row Actions Menu

BEFORE:
AFTER:

Pattern 4: Status Badges

BEFORE:
AFTER:

Pattern 5: Currency Formatting

BEFORE:
AFTER:

Pattern 6: Date Formatting

BEFORE:
AFTER:

Pattern 7: Pagination

BEFORE:
AFTER:

Pattern 8: Row Selection with Bulk Actions

BEFORE:
AFTER:

Common Gotchas

1. Column Key Must Be Unique

2. Accessor Must Return Sortable Value

3. Remember filterable: true for Searchable Columns

4. Use hideOnMobile for Non-Essential Columns

5. Custom Render Must Handle Null/Undefined


Step-by-Step Migration Checklist

For each table file:

Preparation

  • Review current implementation
  • Identify all features (filters, sorting, pagination, actions)
  • Note any custom rendering

Migration

  • Add imports from @/platform/table
  • Define Column<T>[] array
  • Map existing TableHead elements to columns
  • Add type for currency/date/boolean columns
  • Add filterable: true for searchable columns
  • Add hideOnMobile: true for non-essential columns
  • Move row actions to column render function
  • Replace filter state with useDataTable hook
  • Replace <Table> with <DataTable>
  • Add TableFilters component if filters exist
  • Add TablePagination component if pagination needed
  • Add bulk actions if selection exists

Testing

  • Verify loading state shows skeleton
  • Verify empty state displays correctly
  • Verify filtering works (global + column)
  • Verify sorting works
  • Verify pagination works
  • Verify row actions work
  • Verify mobile responsiveness
  • Verify accessibility (keyboard navigation)

Cleanup

  • Remove unused imports
  • Remove duplicate utility functions
  • Update component props if simplified

Need Help?

  • DataTable API: See src/platform/table/README.md
  • Column Types: See src/platform/table/types.ts
  • Examples: See existing platform tables
  • Issues: Document in migration audit file