Plinth

Data Table

Sortable, filterable, paginated table on TanStack Table.

Status
INV-001Duggup$450Paid
INV-002Draftsy$300Paid
INV-003N1 Health$1200Pending
INV-004Mejjos$800Paid
Page 1 of 2

Sorting, the client filter box, and pagination above are live.

Install

npx shadcn@latest add https://plinth.dhrumilkherde.com/r/data-table.json

Usage

Define columns with TanStack's ColumnDef; Plinth owns the rendering.

import { DataTable, DataTableSortHeader, type ColumnDef } from "@/components/ui/data-table";

type Payment = { invoice: string; client: string; amount: number };

const columns: ColumnDef<Payment, unknown>[] = [
  {
    accessorKey: "invoice",
    header: ({ column }) => (
      <DataTableSortHeader column={column}>Invoice</DataTableSortHeader>
    ),
  },
  { accessorKey: "client", header: "Client" },
  {
    accessorKey: "amount",
    header: "Amount",
    cell: ({ row }) => <span className="tabular-nums">${row.original.amount}</span>,
  },
];

<DataTable
  columns={columns}
  data={payments}
  filterColumn="client"
  pageSize={10}
/>

Props

PropTypeDefault
columnsColumnDef[]required
dataTData[]required
filterColumnstring (column id)— (hides search)
filterPlaceholderstringFilter…
pageSizenumber— (no pagination)

For column pinning, row selection, and server-side data, drop down to TanStack Table directly; the Table primitives compose with any of it.

Accessibility

  • Sort toggles are real buttons inside th cells.
  • Pagination controls disable at the bounds rather than disappearing, keeping the tab order stable.

On this page