RE

React Table

@tanstack/react-table

Headless UI for building powerful tables & datagrids for React.

Tables
react
table
react-table
datagrid
tanstack-intent
@tanstack/react-table
Tables
javascript
npm
frontend
Stars
28k
Weekly
0
Open issues
62
Bundle
~60 kB

Installation

npm install @tanstack/react-table

Code example

import { useReactTable, getCoreRowModel, flexRender } from "@tanstack/react-table";

const data = [
  { name: "Ada", role: "Engineer" },
  { name: "Linus", role: "Maintainer" },
];

const columns = [
  { accessorKey: "name", header: "Name" },
  { accessorKey: "role", header: "Role" },
];

export function Example() {
  const table = useReactTable({ data, columns, getCoreRowModel: getCoreRowModel() });

  return (
    <table>
      <thead>
        {table.getHeaderGroups().map((hg) => (
          <tr key={hg.id}>
            {hg.headers.map((h) => (
              <th key={h.id}>{flexRender(h.column.columnDef.header, h.getContext())}</th>
            ))}
          </tr>
        ))}
      </thead>
      <tbody>
        {table.getRowModel().rows.map((row) => (
          <tr key={row.id}>
            {row.getVisibleCells().map((cell) => (
              <td key={cell.id}>{flexRender(cell.column.columnDef.cell, cell.getContext())}</td>
            ))}
          </tr>
        ))}
      </tbody>
    </table>
  );
}

Pros & cons

Pros

  • Actively maintained by Tanner Linsley
  • 0 weekly downloads. Battle tested
  • First-class TypeScript definitions
  • MIT licensed

Considerations

  • Adds roughly ~60 kB to your bundle
  • Needs client-only rendering in SSR frameworks
  • Not supported in React Native
  • 62 open issues on GitHub

FAQs

Alternatives & similar libraries