AdaptTable for shadcn

Rows in shadcn

A row is more than a record. Pin it under the header or to the floor of the scroll box, merge cells that share a team so the name is written once, and add or delete through the 3-dot menu.

rowPinning(), cellSpan() and rowActionsLayout="menu" are what this page turns on. Add and delete are callbacks to the host — the table never owns the data. Movement across flat, grouped and tree rows lives on the dedicated row-reordering page.

The pin actions, the menu and the merged cells are shadcn. Independent pinned summary rows — totals that are not data rows — live on the aggregation page.

The 3-dot trigger wears the preset's button classes, the menu is the same surface as every other overlay, and a Team merge is one td with rowspan. The drag grip lives on the row-reordering page.

The code

import { DataTable } from "@adapttable/shadcn";
import { cellSpan } from "@adapttable/shadcn/cell-span";
import { rowPinning } from "@adapttable/shadcn/row-pinning";

export function People({ rows, columns, setPinned, spanTeam }) {
  return (
    <DataTable
      data={rows}
      columns={columns}
      rowKey={(row) => row.id}
      rowActionsLayout="menu"
      features={[
        rowPinning({ onPinnedRowIdsChange: setPinned }),
        cellSpan(spanTeam),
      ]}
    />
  );
}

Install

pnpm add @adapttable/shadcn @adapttable/core

The same feature in the other kits

More shadcn features

Reference: row-pinning, row-reordering, row-spanning. More of this kit: AdaptTable for shadcn, or the live demo.