const columns = [
  {
    Header: "First Name",
    accessor: "first",
  },
  {
    Header: "Last Name",
    accessor: "last",
  },
  {
    Header: "Email",
    accessor: "email",
  },
];

const data = [
  {
    first: "John",
    last: "Doe",
    email: "john@doe.com",
  },
  {
    first: "Dorothy",
    last: "Boe",
    email: "dorothy@boe.com",
  },
  {
    first: "Baby",
    last: "Moe",
    email: "baby@moe.com",
  },
];

Table

Display tabular data in row format. Some examples use the following variables for brevity:

Always provide a caption. Columns and data must be memoized.

Code Editor

Code Editor

Use the same number of placeholder rows used while loading to avoid layout shift.

Code Editor

Set the align property to change text alignment. Left by default.

Code Editor

Pass a number to change the minimum width of the table. Disable with a falsy value.

Code Editor

Specify a number to change the offset from 0.

Code Editor

Hold shift to sort by multiple columns. Columns can disable sorting.

Code Editor