Skip to content

Table

The Table component provides a way to display tabular data. It’s a set of composable parts — Table.Root, Table.Header, Table.Body, Table.Footer, Table.Row, Table.Head, Table.Cell, and Table.Caption — that map onto the native HTML table elements, so you assemble exactly the structure you need. Use this when you lay out the rows and columns yourself; reach for Data Table when you want a data-driven table with built-in sorting, selection, and expansion.

Variations

Selection controls

Place a Checkbox or Radio in the first cell to make rows selectable, and mark the chosen rows with selected so they pick up the selected styling.

Row actions and pagination

Pass paginationProps to Table.Root to render a pagination bar below the table, and put a MoreActionsTooltip in a trailing cell for per-row actions.

Linked cells and rows

Give a Table.Cell a to to turn its content into a link, or give the whole Table.Row a to to make every cell navigate to the same place. Opt a cell out of a linked row with disableLink, and tune the link with linkProps (e.g. variant, suffixIcon).

Transparent variant

Set variant="transparent" to drop the outer border and header background — useful when embedding a table inside a card or another container.

Disabled rows

Set disabled on a Table.Row to dim it, show a not-allowed cursor, and suppress its click handler.

Installation

import { Table } from '@harnessio/ui/components'
//...
return (
<Table.Root size="normal">
<Table.Header>
<Table.Row>
<Table.Head>Name</Table.Head>
<Table.Head>Email</Table.Head>
<Table.Head>Display Name</Table.Head>
<Table.Head>Date added</Table.Head>
</Table.Row>
</Table.Header>
<Table.Body>
<Table.Row>
<Table.Cell>John Doe</Table.Cell>
<Table.Cell>john@example.com</Table.Cell>
<Table.Cell>John</Table.Cell>
<Table.Cell>2023-01-01</Table.Cell>
</Table.Row>
</Table.Body>
</Table.Root>
)