Component

Table

Composable, semantic table primitives — Table, TableHeader, TableBody, TableRow, TableHead, TableCell and TableCaption map one-to-one to the HTML elements, so cells can hold any component. Use DataTable when you want sorting and filtering driven by column definitions.

Basic

Cells hold components; numeric columns align to the end with tabular figures.

Recent orders
OrderCustomerStatusTotalActions
#1001Ada Lovelace
Shipped
$1,200.00
#1002Alan Turing
Pending
$84.50
#1003Grace Hopper
Shipped
$312.00

Compact, eyebrow headers

density and headTone on the root apply to every cell.

Recent orders
OrderCustomerStatusTotal
#1001Ada Lovelace
Shipped
$1,200.00
#1002Alan Turing
Pending
$84.50
#1003Grace Hopper
Shipped
$312.00

Installation

$pnpm add @refraction-ui/react

Usage

tsx
import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from '@refraction-ui/react'

export function Orders({ orders }) {
  return (
    <Table>
      <TableHeader>
        <TableRow>
          <TableHead>Customer</TableHead>
          <TableHead align="end">Total</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        {orders.map((o) => (
          <TableRow key={o.id}>
            <TableCell><a href={`/customers/${o.customerId}`}>{o.customer}</a></TableCell>
            <TableCell align="end" numeric>{o.total}</TableCell>
          </TableRow>
        ))}
      </TableBody>
    </Table>
  )
}

Props

PropTypeDefaultDescription
density'compact' | 'default''default'Table: cell padding for every cell.
headTone'default' | 'eyebrow''default'Table: header cell look; eyebrow is small uppercase tracked text.
fixedbooleanfalseTable: fixed layout — column widths come from the header row.
containerClassNamestring--Table: class for the horizontal scroll container.
align'start' | 'center' | 'end''start'TableHead / TableCell: horizontal alignment.
numericbooleanfalseTableCell: tabular figures, no wrapping.
scopestring'col'TableHead: defaults to col.