Basel Standard / Docs
Table
Structured table primitive for dense product-facing data and repeatable row rhythm.
| Item | Owner | Status |
|---|---|---|
| Launch issue 04 | Editorial | Ready |
| Spec revision | Product | Review |
| Shelf imagery | Studio | Queued |
The table primitives keep row rhythm, numeric alignment, and selection states consistent across denser data surfaces. They are intentionally simple wrappers around HTML table elements, with the Swiss styling work concentrated in spacing, borders, uppercase headers, and row-state treatment.
Installation
Purchase access, then open /account/install to issue a registry token.Usage
import {
Table,
TableBody,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"
<Table>
<TableHeader>
<TableRow>
<TableHead>Item</TableHead>
<TableHead>Status</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Launch issue 04</TableCell>
<TableCell>Ready</TableCell>
</TableRow>
</TableBody>
</Table>
Why This Primitive Exists
Product tables need more than plain HTML defaults, but they do not need a full data-grid abstraction every time.
- Use these primitives when the information is genuinely tabular and column comparison matters.
- Keep the schema stable so users can scan down the same columns repeatedly.
- Avoid tables for short lists that are easier to read as stacked cards or items.
Examples
Basic Structure
Start with the six core building blocks and let the content determine the column widths.
| Item | Owner | Status |
|---|---|---|
| Launch issue 04 | Editorial | Ready |
| Spec revision | Product | Review |
| Shelf imagery | Studio | Queued |
Numeric Columns
The Swiss table includes a repo-specific data-numeric convention on TableHead and TableCell so counts, prices, and totals line up cleanly.
| Region | Orders | Revenue |
|---|---|---|
| North America | 148 | $42,300 |
| Europe | 96 | $31,180 |
| Asia Pacific | 74 | $19,640 |
<TableHead data-numeric="true">Revenue</TableHead>
<TableCell data-numeric="true">$42,300</TableCell>
In Context
Tables become more useful when selection, hover state, and surrounding panel hierarchy all reinforce the current row.
Operations table
| SKU | Stock | Status |
|---|---|---|
| CH-104 | 18 | Allocated |
| CH-108 | 42 | Available |
| CH-112 | 7 | Backorder |
<TableRow data-state="selected">
<TableCell>CH-104</TableCell>
<TableCell data-numeric="true">18</TableCell>
<TableCell>Allocated</TableCell>
</TableRow>
Guidance
Use Tables For Comparison
- Reach for a table when users need to scan several records against the same set of columns.
- Prefer cards or list items when each row has a different internal structure.
- Keep column labels short and explicit so the header reads quickly.
Respect Numeric Alignment
- Apply
data-numeric="true"to both the header and cells of numeric columns. - Use tabular values for prices, counts, and percentages so totals stay visually aligned.
- Avoid mixing freeform text into numeric columns unless the interface absolutely requires it.
Keep Row State Legible
- Use
data-state="selected"onTableRowwhen the row is actively selected. - Let hover and focus states support scanability rather than turn the table into a high-contrast grid.
- If the surface needs filtering, bulk actions, or pagination, compose those controls around the table instead of inside the cells.
API Reference
Exports
| Export | Renders | Notes |
|---|---|---|
Table | wrapper div + table | Adds horizontal overflow handling and the outer border. |
TableHeader | thead | Applies the stronger bottom border rhythm for header rows. |
TableBody | tbody | Removes the trailing row border on the last row. |
TableFooter | tfoot | Adds muted background treatment for summary rows. |
TableRow | tr | Includes hover, focus-within, and optional selected styling. |
TableHead | th | Uppercase condensed header cell. |
TableCell | td | Default body cell spacing and text treatment. |
TableCaption | caption | Muted caption copy below the table. |
Repo-Specific Behaviors
| Pattern | Detail |
|---|---|
data-numeric="true" | Right-aligns numbers and enables tabular alignment on TableHead and TableCell. |
data-state="selected" | Applies the selected row background on TableRow. |
| focus within row | Adds the stronger inset border treatment while interactive content inside the row has focus. |
All components accept the standard props for their underlying HTML elements plus className.