Open source React component

React Table

A fast, accessible data table for React. Sorting, filtering, grouping, editing, paging and virtual scrolling work out of the box, and you take full control of the state when you need it.

The version on npm The stars on GitHub The downloads per week The license: MIT

A live ka-table: sort by the headers, filter, click a cell to edit it

The live table could not be loaded. Open the demos

Quick start

Your first table in a minute

Install the package, import the styles and pass the columns and the data. Sorting, filtering, editing and paging are one prop each.

npm install ka-table
import 'ka-table/style.css';
import { Table } from 'ka-table';
import { DataType, SortingMode } from 'ka-table/enums';

const columns = [
  { key: 'name', title: 'Name', dataType: DataType.String },
  { key: 'score', title: 'Score', dataType: DataType.Number },
];

const data = [
  { id: 1, name: 'Ava Brooks', score: 92 },
  { id: 2, name: 'Liam Carter', score: 78 },
];

export const App = () => (
  <Table
    columns={columns}
    data={data}
    rowKeyField="id"
    sortingMode={SortingMode.Single}
  />
);

Features

Everything a data table needs

Every feature has a demo with the code and a page in the docs.

Sorting

Sort by a click on the header: one column or several, in three states, with your own comparator or on the server.

Filtering and search

A filter row with editors for every data type, header filters with a list of values, and search across all the columns.

Editing and validation

Edit a cell or a whole row, add new rows and validate the values before they are saved.

Grouping and tree

Group the rows by one or more columns with summaries, or show hierarchical data as a tree.

Paging

Built-in paging with a choice of page sizes, or remote paging for the data loaded from a server.

Selection

Select one row or many, all the rows or only the filtered ones, and read the selected data.

Virtual scrolling

Only the visible rows and columns are rendered: hundreds of thousands of rows scroll smoothly.

Fixed columns

Keep the key columns in view: they stick to the left or the right edge while the table scrolls.

Keyboard and accessibility

A WAI-ARIA grid: the arrows, Home, End and Page Up and Down move the focus, Enter opens the editor.

Themes

Plain CSS with custom properties: change the colors, switch on the dark theme or use Bootstrap and Material UI.

Customization

Replace any cell, row, editor or header cell with your own component and handle any event.

TypeScript

The type of the rows is inferred from your data, and every action of the table is typed.

Your design

Customize every part

Render your own cells, rows, editors, header cells and pager with childComponents, and add any event handlers. The styles are plain CSS with --ka-* custom properties: change the colors, switch on the dark theme, or style the table with Bootstrap or Material UI.

A customized ka-table

ka-table 13

What's new

  • Fixed columns. fixed: 'left' or 'right' keeps a column at the edge while the table scrolls.
  • Keyboard navigation. The table is a WAI-ARIA grid with a single Tab stop, on by default.
  • Virtual columns. virtualScrolling.horizontal renders only the visible columns.
  • Memoized rows. With memoizedRows only the changed rows are rendered again: 300K rows stay fast.
  • Themes in plain CSS. --ka-* custom properties and a dark theme, no Sass.
  • Typed actions. TableAction is narrowed by action.type, and useTableSelector() re-renders only on the selected value.
  • React 18 and 19. An ES2019 build with CommonJS and ES modules.

Free and open source

ka-table is MIT licensed: use it in any project, commercial ones included. Issues, ideas and pull requests are welcome.