Table

Powerful responsive data table with sticky headers, smooth scrolling, sorting, and pagination.

Team roster (basic table using head/body/footer)
IDNameEmailAgeRole
1shadcnshadcn@example.com26Pro Developer
2Ahdeetaiahdeetai@example.com21Cool Developer
3ManuAroramanuarora@example.com35Ace Developer
4DavidHazdavidhaz@example.com27Top Developer
5Royroy@example.com31Star Developer
Total members5

Installation

npx shadcn@latest add https://scrollxui.dev/registry/table.json 

Usage

// Basic Usage
import {
  Table,
  TableBody,
  TableCaption,
  TableCell,
  TableHead,
  TableHeader,
  TableRow,
} from "@/components/ui/table"
<Table>
  <TableCaption>A list of your recent invoices.</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead className="w-[100px]">Invoice</TableHead>
      <TableHead>Status</TableHead>
      <TableHead>Method</TableHead>
      <TableHead className="text-right">Amount</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell className="font-medium">INV001</TableCell>
      <TableCell>Paid</TableCell>
      <TableCell>Credit Card</TableCell>
      <TableCell className="text-right">$250.00</TableCell>
    </TableRow>
  </TableBody>
</Table>
// DataTable Example
<DataTable
  columns={[
    { accessorKey: 'invoice', header: createSortableHeader('Invoice') },
    { accessorKey: 'status', header: 'Status' },
    { accessorKey: 'method', header: 'Method' },
    { accessorKey: 'amount', header: 'Amount', cell: ({ row }) => `$${row.original.amount}` },
  ]}
  data={[
    { invoice: 'INV001', status: 'Paid', method: 'Credit Card', amount: 250 },
    { invoice: 'INV002', status: 'Pending', method: 'PayPal', amount: 150 },
  ]}
  pageSize={5}
  searchable
  pagination
/>

Examples


DataTable

1
shadcn
shadcn@example.com
26
Pro Developer
2
Ahdeetai
ahdeetai@example.com
21
Cool Developer
3
ManuArora
manuarora@example.com
35
Ace Developer
4
DavidHaz
davidhaz@example.com
27
Top Developer
5
Roy
roy@example.com
31
Star Developer
0 of 7 row(s) selected.
Rows per page:

Page 1 of 2


Scrollable

1
shadcn
shadcn@example.com
26
Pro Developer
2
Ahdeetai
ahdeetai@example.com
21
Cool Developer
3
ManuArora
manuarora@example.com
35
Ace Developer
4
DavidHaz
davidhaz@example.com
27
Top Developer
5
Roy
roy@example.com
31
Star Developer
6
Lee Robinson
leerobinson@example.com
38
Master Developer
7
Guillermo Rauch
guillermorauch@example.com
34
Best Developer
8
Dan Abramov
danabramov@example.com
28
Prime Developer
9
Kent C. Dodds
kentcdodds@example.com
30
Epic Developer
10
Mark Zuckerberg
markzuckerberg@example.com
41
Boss Developer

Checkbox

1
shadcn
shadcn@example.com
26
Pro Developer
2
Ahdeetai
ahdeetai@example.com
21
Cool Developer
3
ManuArora
manuarora@example.com
35
Ace Developer
4
DavidHaz
davidhaz@example.com
27
Top Developer
5
Roy
roy@example.com
31
Star Developer
0 of 7 row(s) selected.
Rows per page:

Page 1 of 2

API Reference

Table

Powerful responsive data table with sticky headers, smooth scrolling, sorting, and pagination.

Props

PropertyTypeDefaultDescription
columnsColumnDef<any>[][]
Defines the table columns and their configuration.
dataany[][]
Array of data objects to display in the table.
enableScrollbooleanfalse
Enables vertical and horizontal scrolling with sticky header.
scrollHeightstring | number"400px"
Max height for vertical scroll when scrolling is enabled.
enableAnimationsbooleanfalse
Adds smooth animations for row transitions.
staggerDelaynumber0.05
Delay between row animations when animating rows.
paginationbooleanfalse
Enables pagination controls for the table.
showPageSizeSelectorbooleantrue
Shows dropdown to select rows per page when pagination is enabled.
rowClassNamestring
Custom class name applied to each table row.
cellClassNamestring
Custom class name applied to each table cell.
emptyMessagestring | ReactNode"No results"
Message displayed when there are no rows to show.
onRowClick(rowData: any) => void
Callback fired when a row is clicked, receives row data.
tableClassNamestring
Custom class name applied to the table element.
...propsHTMLDivElement attributes
Supports all standard div props and events.

Built withby Ahdeetai.