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 createnpx @tanstack/cli@latest createyarn dlx @tanstack/cli@latest createbunx @tanstack/cli@latest createChoose 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-startnpx @react-datatable/cli install --token <license-token> --framework tanstack-startyarn dlx @react-datatable/cli install --token <license-token> --framework tanstack-startbunx @react-datatable/cli install --token <license-token> --framework tanstack-startThe 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 />
}