Demos

Biomarker results with reference ranges and a status.

Usage

Use a table when the reader needs to compare values across rows, such as results, invoices, or appointments. The parts are styled HTML table elements, so you write the rows yourself.

Import it from @workspace/ui/components/table.

Anatomy

  • Table — The table, inside a wrapper that scrolls sideways on narrow screens.
  • TableHeader, TableBody, and TableFooter — thead, tbody, and tfoot.
  • TableRow — A row with a hover style.
  • TableHead — A header cell.
  • TableCell — A data cell.
  • TableCaption — A caption below the table.

Notes

  • Right-align numbers with text-end and add tabular-nums so digits line up.
  • Put the unit in the cell or the header, never only in a tooltip.
  • Add data-state="selected" to a row to highlight it.
  • Add a TableCaption so screen readers know what the table holds.

Examples

A footer row for totals.

Props

Each part takes the props of its HTML element, plus className.