AdaptTable for shadcn

Accessible shadcn data table

Tab into the grid and the arrows move a visible focus, one cell at a time. Home and End jump to the row's edges.

Every move, sort, filter and edit is announced through a live region — the part of a table a sighted reader cannot check, so this page repeats those announcements as text as they happen.

columnSelectionCheckbox puts a named checkbox on each header so a column can be selected without a modifier key a touchscreen does not have. Focus, selection, status and disabled controls stay legible in high contrast and forced-colors — nothing is color-only. The grid and the checkboxes are shadcn.

The grid is semantic markup wearing the preset; the header checkbox is a native input with the preset's classes, and the focus ring is the same outline the rest of the table uses.

The code

import { DataTable } from "@adapttable/shadcn";
import { cellNavigation } from "@adapttable/shadcn/cell-navigation";
import { columnSelectionCheckbox } from "@adapttable/shadcn/column-selection";

export function People({ rows, columns }) {
  return (
    <DataTable
      data={rows}
      columns={columns}
      rowKey={(row) => row.id}
      features={[cellNavigation(), columnSelectionCheckbox()]}
    />
  );
}

Install

pnpm add @adapttable/shadcn @adapttable/core

The same feature in the other kits

More shadcn features

Reference: accessibility, cell-navigation. More of this kit: AdaptTable for shadcn, or the live demo.