Skip to main content

Row selection & action bar

<DataTable
enableRowSelection
onSelectionChange={(rows) => setSelected(rows)}
actionBar={(table) => <MyActionBar table={table} />}
initialState={{ columnPinning: { left: ["select"] } }}
/>

When enableRowSelection is true, a checkbox column is injected. The action bar appears when one or more rows are selected.

Action bar building blocks​

Import from the action bar module:

import {
DataTableActionBar,
DataTableActionBarAction,
DataTableActionBarSelection,
} from "@/components/datatable/components/data-table-action-bar";

Typical actions: copy IDs, export CSV, bulk delete (with confirmation), open multi-edit.

Selection state is not stored in the URL.