Skip to content

Table

A semantic HTML table component with visual variants for displaying structured data.

  • stable
  • since v0.1.0
  • 0.7 kB
  • data-display
  • table
  • accessible

Uses native <table> semantics; TableHeader renders <th scope="col"> by default; numeric cells use data-numeric for screen-reader context.

Preview
Open
tsx

Use variant="striped" to apply alternating row backgrounds for easier scanning.

Preview
Open
tsx

Use size="sm" for dense tables — useful in dashboards and log viewers.

Preview
Open
tsx
PropTypeDefaultDescription
variant
"line"|"striped"|"grid"|"minimal"
line
Visual treatment: `line` shows row dividers, `striped` zebras alternating rows, `grid` draws both row and column borders, `minimal` strips all chrome.
size
"sm"|"md"|"lg"
md
Density preset for padding and font size.
stickyHeader
boolean
false
Pin the `<thead>` to the top of the scroll container while the body scrolls vertically. Requires the table to live inside a scrollable ancestor for it to take effect.
layout
"auto"|"fixed"
auto
CSS `table-layout` strategy. `auto` (default) sizes columns from content; `fixed` distributes width based on the first row only and is faster for wide tables.
  • The component renders a native <table> element with proper semantic structure.
  • TableHeader defaults to scope="col" so screen readers can associate headers with data cells.
  • Pass numeric to TableCell to set data-numeric="true" and right-align values; this does not alter the accessible label.
  • Use TableCaption to provide a visible or visually-hidden caption that describes the table purpose.
  • stickyHeader keeps column headers visible while scrolling long tables.
  • Use variant="grid" for a full-bordered spreadsheet appearance.
  • Use variant="minimal" to strip all borders for an ultra-clean look.
  • Wrap the table in a scrollable container when the column count may overflow on narrow screens.
  • Pair with layout="fixed" when column widths should be driven by the header, not cell content.
  • Combine variant="striped" + stickyHeader for long financial or data-heavy tables.