Data Table

NEW

A sortable, searchable data table with sticky headers, row selection and range selection, animated bulk actions, paging, responsive stacked cards, and ready-made sparkline and delta cells.

Top products

Sort any column, select rows, or search. On a phone it turns into cards.

14-day trend
Floor LampLighting
$73,174
1,152
2.3%
12.8%
Linen ShirtApparel
$72,504
742
2.2%
5.2%
Bamboo ShelfFurniture
$67,176
733
4.0%
23.4%
Studio HeadphonesAudio
$66,463
939
4.3%
15.0%
Soy CandleHome
$66,377
895
4.2%
47.5%
Leather WalletAccessories
$64,015
1,968
6.2%
11.8%
Linen ThrowTextiles
$63,979
1,789
1.3%
20.3%
Camp BlanketTextiles
$63,418
696
6.2%
58.0%
Travel MugKitchen
$62,942
885
3.8%
14.5%
Noise SpeakerAudio
$58,428
645
5.0%
34.3%
Pocket NotebookStationery
$58,255
1,174
4.7%
43.7%
Desk MatStationery
$56,815
1,557
5.2%
4.3%
Showing 12 of 24

Installation

Add the component directly to your repository using shadcn CLI:

npx shadcn@latest add Surajmaurya1/easyui/data-table

API Reference

PropTypeDefaultDescription
rowsT[]requiredRows to render. Each row must include a stable id
columnsDataTableColumn<T>[]requiredColumn definitions with headers, accessors, custom cells, alignment, widths, and mobile behavior
getRowLabel(row: T) => stringString(row.id)Readable row name used by checkbox labels and screen readers
selectablebooleantrueEnables row selection, select-all, and the bulk-action bar
searchablebooleantrueShows the search field that filters rows
searchPlaceholderstring'Search…'Placeholder text for the search field
searchText(row: T) => stringundefinedExtra text to match when searching beyond the column accessors
defaultSortSortStatenullInitial sort used when the sort prop is not controlled
sortSortStateundefinedControlled sort state
onSortChange(sort: SortState) => voidundefinedCallback fired whenever the sort changes
selectedId[]undefinedControlled selection state
onSelectionChange(ids: Id[]) => voidundefinedCallback fired whenever the selection changes
bulkActions(selectedIds: Id[]) => ReactNodeundefinedButtons rendered in the bar while rows are selected
toolbarReactNodeundefinedExtra controls rendered on the right side of the toolbar
pageSizenumber20Rows shown initially and revealed per "Show more" click. Infinity shows all rows
maxHeightnumber520Table scroll height in pixels before the header sticks
density'comfortable' | 'compact''comfortable'Row padding and minimum height
cardBreakpointnumber640Width below which rows render as stacked cards
onRowClick(row: T) => voidundefinedMakes rows interactive and keyboard-activatable
emptyStateReactNodeundefinedCustom content shown when no rows match
ariaLabelstring'Data table'Accessible name for the table region
classNamestringundefinedCustom Tailwind class names for the outer wrapper