AdaptTable for Ant Design

Column management in Ant Design

Everything a user expects to do to a column, without writing a column-settings panel: show and hide, reorder by drag, pin to either edge, resize by drag or keyboard, and switch row density.

Pinning is logical rather than physical, so a column pinned to the start stays on the correct side in a right-to-left layout.

The arrangement is state like any other: persist it to the URL, to localStorage, or to your own server through columnLayout and onColumnLayoutChange.

The menu is a controlled antd Popover with its content padding stripped, flipped by writing direction, and closed by a keydown listener the adapter adds — antd's Popover has no Escape handling of its own.

The code

import { DataTable } from "@adapttable/antd";

export function People({ rows, columns, layout, onLayout }) {
  return (
    <DataTable
      data={rows}
      columns={columns}
      rowKey={(row) => row.id}
      enableColumnMenu
      resizableColumns
      columnLayout={layout}
      onColumnLayoutChange={onLayout}
    />
  );
}

Install

pnpm add @adapttable/antd @adapttable/core antd

The same feature in the other kits

More Ant Design features

Reference: column-management, columns. More of this kit: AdaptTable for Ant Design, or the live demo.