react-datatable
Installation

TanStack Start

Use this path for TanStack Start projects created with the TanStack CLI.

Create or open a TanStack Start app

If you need a new app, create one first:

pnpm dlx @tanstack/cli@latest create
npx @tanstack/cli@latest create
yarn dlx @tanstack/cli@latest create
bunx @tanstack/cli@latest create

Choose TanStack Start, React, and the recommended defaults so Tailwind CSS and the @/* import alias are configured.

Confirm Tailwind and aliases

The recommended TanStack Start template already includes Tailwind and a @/* alias. If your app is custom, make sure src/styles/app.css imports Tailwind and TypeScript resolves @/* to src/*.

Install react-datatable

Run the installer from the app root:

pnpm dlx @react-datatable/cli install --token <license-token> --framework tanstack-start
npx @react-datatable/cli install --token <license-token> --framework tanstack-start
yarn dlx @react-datatable/cli install --token <license-token> --framework tanstack-start
bunx @react-datatable/cli install --token <license-token> --framework tanstack-start

The default target is src/react-datatable.

Create a table component

Create src/components/CustomersTable.tsx:

import { Datatable, type DatatableColumn } from "@/react-datatable"

type Customer = { id: string; company: string }

const rows: Customer[] = [
  { id: "1", company: "Acme Inc." },
  { id: "2", company: "Globex" },
  { id: "3", company: "Initech" },
  { id: "4", company: "Umbrella" },
  { id: "5", company: "Stark Industries" },
]

const columns: DatatableColumn<Customer>[] = [
  { id: "company", accessorKey: "company", header: "Company", filterType: "text" },
]

export function CustomersTable() {
  return <Datatable tableKey="customers" columns={columns} data={rows} getRowId={(row) => row.id} />
}

Render it in a route

import { createFileRoute } from "@tanstack/react-router"
import { CustomersTable } from "@/components/CustomersTable"

export const Route = createFileRoute("/")({
  component: Page,
})

function Page() {
  return <CustomersTable />
}

Verify the app

Run your app's build command:

pnpm run build
npm run build
yarn build
bun run build

On this page