AdaptTable for Tailwind

Saved views in Tailwind

A view is everything the table can put in a URL — search, sort, filters, grouping, the column layout, density and the pivot — saved under a name.

Readers pick one from the views menu; the panel beside the table renames, reorders, sets the default and deletes. A view someone else shared arrives read-only and says so on the row.

Both are native elements — buttons, inputs, a list — and every one of them takes your classes, so the panel matches the rest of your app because you styled it, not because a kit did.

Every row is native markup carrying the map's classes — a gray-bordered button per name, an indigo ring on the rename input, and the save action in bg-indigo-600.

The code

import {
  DataTable,
  SavedViewsPanel,
  useSavedViews,
} from "@adapttable/unstyled";

export function People({ rows, columns }) {
  const views = useSavedViews({
    storageKey: "people-views",
    urlKey: "v",
  });
  return (
    <>
      <SavedViewsPanel
        views={views.views}
        onApply={views.apply}
        onRename={views.rename}
        onMove={views.move}
        onSetDefault={views.setDefault}
        onRemove={views.remove}
      />
      <DataTable
        data={rows}
        columns={columns}
        rowKey={(row) => row.id}
        urlKey="v"
        savedViews={{ storageKey: "people-views" }}
      />
    </>
  );
}

Install

pnpm add @adapttable/unstyled @adapttable/core

The same feature in the other kits

More Tailwind features

Reference: saved-views, url-state. More of this kit: AdaptTable for Tailwind, or the live demo.