Hewn
Components

Components

DataTable

Advanced table powered by TanStack Table on Hewn surfaces.

newfree

Install

@hewnui/ui · hewnui

Terminal
# Available at launch: npm install @hewnui/ui
Terminal
# Available at launch: pnpm add @hewnui/ui
Terminal
# Available at launch: yarn add @hewnui/ui
Terminal
# Available at launch: bun add @hewnui/ui
Terminal
# Available at launch: npx hewnui@latest add data-table

DataTable keeps Hewn visuals while TanStack owns sorting state and column definitions. Use the foundation Table for simpler static grids.

NameRoleScore
Nova HaleOps92
Riven ColeDesign88
Mira QuillEngineering95

Usage

TSX
import { DataTable, type ColumnDef } from "@hewnui/ui";

const columns: ColumnDef<Row>[] = [
  { accessorKey: "name", header: "Name" },
  { accessorKey: "score", header: "Score" },
];

<DataTable aria-label="Scores" columns={columns} data={rows} />

Accessibility

  • aria-label is a required prop, so the table is never unnamed
  • React Aria grid semantics: arrow keys move between cells, Home/End jump along a row
  • The first column is the row header, giving each row a name when a cell is read in isolation
  • Sortable headers expose aria-sort (none, ascending, descending) and toggle with Enter or Space — the caret glyph is aria-hidden, so sort state never depends on seeing it
  • Sorting is driven through React Aria's sortDescriptor, so the announcement stays in sync with the TanStack sort state

API reference

Props for DataTable from @hewnui/ui/data-table. Generated from component types — not hand-written.

Prop

Type

On this page