Data Table

The Data Table component allows for easy display of tabular data with options for sorting and row interaction.

Usage & Examples

Default

Data table
Status
1Alice91Pass
2Bob75Pass
3Charlie58Fail
4Dana84Pass
default.tsx
 const sampleData = [
    { id: 1, name: "Alice", score: 91, passed: true },
    { id: 2, name: "Bob", score: 75, passed: true },
    { id: 3, name: "Charlie", score: 58, passed: false },
    { id: 4, name: "Dana", score: 84, passed: true },
  ];

  <DataTable
            data={sampleData}
            columns={[
              { key: "id", label: "ID", sortable: true },
              { key: "name", label: "Name", sortable: true },
              { key: "score", label: "Score", sortable: true },
              {
                key: "passed",
                label: "Status",
                sortable: false,
                render: (value: unknown) => (value ? "Pass" : "Fail"),
              },
            ]}
            theme="primary"
            striped={true}
          />

Props API

90 props
Columns
Data Table props API
Default
Description
aria-describedbystringNoariaAccessible description reference for the table. Useful for tying helper or instructional text to the table.
aria-labelstringNoariaAccessible label for screen readers. Use this when there is no visible caption or heading tied to the table.
aria-labelledbystringNoariaAccessible labelledby reference for the table. Prefer this when a visible heading already labels the table.
bulkActions((selectedKeys: Array<string | number>, selectedRows: T[]) => ReactNode)NoeventsOptional actions shown only when one or more rows are selected.
bulkToolbarClassNamestringNopropsOptional class name for the bulk action toolbar.
captionstringNoprops"Data table"Optional visible or screen-reader-only caption text for the table. A table caption is the preferred built-in table label.
cellClassName((value: unknown, row: T, column: Column<T>, rowIndex: number) => string)NoeventsOptional dynamic class name for each cell.
classNamestringNostylingOptional class name for the table wrapper.
colCountnumberNopropsTotal column count override. Helpful when rendering dynamic or grouped columns in advanced cases.
columnMenuClassNamestringNopropsOptional class name for the column visibility menu.
columnOrder(keyof T)[]NopropsControlled column order.
columnPinningbooleanNopropsfalseEnables column pin/unpin controls.