AdaptTable for shadcn

Live updates in shadcn

Rows patch in as they arrive, the way a websocket would. This page applies one budget change at a time so the movement is followable.

Patches go through the row-patch API rather than replacing the array, so search, filters and sort re-run for the touched rows only — your scroll and selection survive.

The feed lists every patch as it lands. The table is shadcn.

The feed is the host's chrome; a patched budget is an ordinary cell wearing the preset, with a new number inside it.

The code

import { DataTable } from "@adapttable/shadcn";
import { applyRowPatches, updateRow } from "@adapttable/core";

export function People({ rows, columns, setRows }) {
  const patchBudget = (id, budget) =>
    setRows(
      applyRowPatches(
        rows,
        [updateRow(id, { budget })],
        (row) => row.id
      )
    );
  return (
    <DataTable
      data={rows}
      columns={columns}
      rowKey={(row) => row.id}
    />
  );
}

Install

pnpm add @adapttable/shadcn @adapttable/core

The same feature in the other kits

More shadcn features

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