Table

The Table component displays structured data using rows and columns. This version includes striped rows and a hover state for improved readability.


Default

A basic table layout with headers and rows.
NameEmailRole
Alice Smithalice@example.comAdmin
Bob Johnsonbob@example.comEditor
Charlie Rosecharlie@example.comViewer
<Table
headers={["Name", "Email", "Role"]}
rows={[
  ["Alice Smith", "alice@example.com", "Admin"],
  ["Bob Johnson", "bob@example.com", "Editor"],
  ["Charlie Rose", "charlie@example.com", "Viewer"],
]}
/>

With action buttons

Tables can include buttons or other interactive elements in any column.
IDNameRoleActions
user_123Alice SmithAdmin
user_456Bob JohnsonEditor
user_789Charlie RoseViewer
<Table
headers={["ID", "Name", "Role", "Actions"]}
rows={[
  [
    "user_123",
    "Alice Smith",
    "Admin",
    <div className="flex justify-end gap-2">
      <Button variant="outlined" size="sm">Copy ID</Button>
      <Button size="sm">View</Button>
    </div>,
  ],
  [
    "user_456",
    "Bob Johnson",
    "Editor",
    <div className="flex justify-end gap-2">
      <Button variant="outlined" size="sm">Copy ID</Button>
      <Button size="sm">View</Button>
    </div>,
  ],
  [
    "user_789",
    "Charlie Rose",
    "Viewer",
    <div className="flex justify-end gap-2">
      <Button variant="outlined" size="sm">Copy ID</Button>
      <Button size="sm">View</Button>
    </div>,
  ],
]}
hover={false}
/>

Props

  • headersarray. The table headers as strings.
  • rowsarray of arrays. Each array represents a table row with cell content as nodes.

Usage

Import the Table component and pass in a set of headers and rows. Each row should be an array of cells — these can include plain text or interactive components. The Table component can be referenced using the following format:

import Table from "../../components/Table";