Table v0.1.0 Data display

Composable data table: Root (scroll container), Header, Body, Row, Head, Cell, Caption.

import { Table } from "latticeui-react";

Examples

Striped and hoverable

ServiceRegionLatencyStatus
api-serverus-east-123 msHealthy
worker-pooleu-west-241 msDegraded
cdn-edgeap-south-1Down
Show code
<Table.Root striped hoverable>
  <Table.Header>
    <Table.Row>
      <Table.Head>Service</Table.Head>
      <Table.Head>Region</Table.Head>
      <Table.Head>Status</Table.Head>
    </Table.Row>
  </Table.Header>
  <Table.Body>
    <Table.Row>
      <Table.Cell>api-server</Table.Cell>
      <Table.Cell>us-east-1</Table.Cell>
      <Table.Cell><Badge tone="success">Healthy</Badge></Table.Cell>
    </Table.Row>
    ...
  </Table.Body>
</Table.Root>

Anatomy

These data-part attributes are a versioned public API - style and test against them; they will not change in a minor release.

PartElementStable selector
rootdiv[data-scope="table"][data-part="root"]
tabletable[data-scope="table"][data-part="table"]
captioncaption[data-scope="table"][data-part="caption"]
headerthead[data-scope="table"][data-part="header"]
bodytbody[data-scope="table"][data-part="body"]
rowtr[data-scope="table"][data-part="row"]
headth[data-scope="table"][data-part="head"]
celltd[data-scope="table"][data-part="cell"]

Props

PropTypeDefaultDescription
Root.stripedboolean
Root.hoverableboolean

Accessibility

Roles: table (native semantics)

Styling

Override styles by targeting the stable selectors below from any unlayered CSS - it always beats the library's @layer latticeui styles, no !important needed.

[data-scope="table"][data-part="cell"] {
  /* your overrides */
}

State attributes: data-stripeddata-hoverable