Table
A styled table for displaying rows of data.
| Date | Description | Amount |
|---|---|---|
| Aug 30 | Salary | + $4,150.00 |
| Aug 24 | Netflix | - $20.00 |
| Aug 17 | Electricity | - $186.35 |
Usage
Table is a thin, styled layer over the native table elements — it keeps the real <table>, <thead>, <tbody>, <tr>, <th>, and <td> semantics and just adds the surface, spacing, rounded corners, and optional striping/hover. All parts live under @appica/ui-react/table:
Table— the<table>root. Ownssize,borderStyle, and thestripedRows/stripedColumns/hoverableRowstoggles.TableHeader/TableBody—<thead>/<tbody>wrappers. The header gets a tinted bar; the body holds the data rows.TableRow— a<tr>. Mark onehighlightedto call it out.TableHead— a<th>header cell (start-aligned by default).TableCell— a<td>data cell.TableCaption— a<caption>that sits above or below the table viaposition.
The rounded corners are applied automatically to the right cells, so you don't manage them by hand. Per-cell alignment (e.g. right-aligned amounts) is just a text-end utility on the relevant TableHead/TableCell.
Examples
Default
Header, body, a caption, and a right-aligned amount column. The outer border, header bar, and corner rounding come for free.
Sizes
size scales the cell padding, corner radius, and text together — sm, md (default), or lg.
Striped
stripedRows tints alternating rows for easier horizontal scanning; stripedColumns does the same down the columns. Use whichever fits the data — or neither.
Hoverable rows
hoverableRows tints a row as the pointer passes over it — handy when each row is a target you'll click or act on.
Border styles
borderStyle switches the cell separators: solid (default), dashed, or none for a borderless, airy look.
Highlighted row
Mark a TableRow as highlighted to single it out — a selected row, the current plan, or a flagged entry. It keeps its background through striping and hover.
Rich content
Cells take any content, so compose them with other components — an Avatar and stacked text in one cell, a Badge for status in another — and pull the caption to the top with position="top".
Scrollable
For a long table, wrap it in a ScrollArea with a fixed height. Pin the header to the top of the viewport with [&>thead>tr>th]:sticky [&>thead>tr>th]:top-0 so the columns stay labelled while the rows scroll.
Horizontal scroll
When a table has more columns than will fit, wrap it in a horizontal ScrollArea and keep the cells from wrapping with whitespace-nowrap. The columns scroll sideways instead of cramping.
RTL
Every Appica UI component supports right-to-left layouts out of the box. Set the dir attribute on a container (commonly your <html> element) so CSS logical properties resolve correctly, and wrap your tree in DirectionProvider so direction-aware behavior follows the same direction.
Columns lay out from the right, the rounded corners mirror to the correct sides, and a text-end amount column moves to the left edge — all because the styling uses logical properties. For setup details and caveats, see the RTL guide.
| التاريخ | الوصف | المبلغ |
|---|---|---|
| ٣٠ أغسطس | الراتب | + ٤٬١٥٠٫٠٠ $ |
| ٢٤ أغسطس | نتفليكس | - ٢٠٫٠٠ $ |
| ١٧ أغسطس | الكهرباء | - ١٨٦٫٣٥ $ |
API reference
Table and its parts are styled native table elements — they're not Base UI primitives. Each forwards ref and every remaining attribute to its underlying element, so standard table attributes (colSpan, scope, …) work as usual.
Table
The <table> root. Owns the surface, sizing, and row/column treatments.
TableCaption
A <caption> describing the table. Placed above or below.
TableRow
A <tr>. Use highlighted to call out a single row.
TableHeader, TableBody, TableHead, TableCell
Thin wrappers over <thead>, <tbody>, <th>, and <td>. They take their native attributes plus className (merged via tailwind-merge). TableHead is start-aligned by default — add text-end (or text-center) for other alignments.
Accessibility
- The component renders real table semantics —
<table>,<thead>,<tbody>,<tr>,<th>,<td>— so screen readers announce rows, columns, and headers natively. - Use
TableHeadfor header cells, and addscope="col"(orscope="row"for a row header) when the relationship isn't obvious, so assistive tech maps each data cell to its header. - A
TableCaptiongives the table an accessible name; keep it even when it's visually subtle. highlightedis a visual cue only — if the highlighted row carries meaning (e.g. "current plan"), convey that in text as well, not by color alone.- Row hover and the highlight are background-only changes that don't affect the reading order or content.