Table
A semantic data table with header, body, rows and cells.
Use a table for records people compare across columns, such as invoices or members. It is native <table> markup with Aloxe styles, so it renders on the server and screen readers navigate it by row and column.
| Invoice | Client | Issued | Status | Amount |
|---|---|---|---|---|
| INV-1042 | Northwind Studio | 3 Feb 2027 | Paid | €1,240.00 |
| INV-1041 | Lumen Bakery | 28 Jan 2027 | Due | €380.50 |
| INV-1040 | Harbor & Pine | 14 Jan 2027 | Overdue | €2,915.00 |
| INV-1039 | Atlas Climbing | 9 Jan 2027 | Paid | €96.00 |
Installation
Pro components install from the Aloxe registry with the shadcn CLI. Once per project, add the registry to components.json and put a registry token in the ALOXE_TOKEN environment variable. Registry has the details.
{
"registries": {
"@aloxe": {
"url": "https://<aloxe-site>/r/{name}.json",
"headers": { "Authorization": "Bearer ${ALOXE_TOKEN}" }
}
}
}Then add the component:
npx shadcn@latest add @aloxe/tableThe CLI copies the source into components/ui/aloxe/, so it never overwrites your own ui components. It also installs @aloxe/react, @aloxe/tokens and @base-ui/react.
Import the tokens once in your global stylesheet, after Tailwind, and add an @source for the copied files and one for @aloxe/react, so Tailwind generates their classes. @source paths are relative to the stylesheet; these assume src/app/globals.css and src/components/ui/aloxe/.
@import "tailwindcss";
@import "@aloxe/tokens/aloxe.css";
@import "@aloxe/tokens/tailwind.css";
@source "../components/ui/aloxe";
@source "../../node_modules/@aloxe/react/dist";Installation covers the theme and brand attributes.
Usage
import { Table, TableBody, TableCell, TableHeader, TableRow } from "@/components/ui/aloxe/table";
<Table>
<caption>Invoices issued this quarter</caption>
<TableHeader>
<TableRow>
<TableCell header>Client</TableCell>
<TableCell header numeric>Amount</TableCell>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Northwind Studio</TableCell>
<TableCell numeric>€1,240.00</TableCell>
</TableRow>
</TableBody>
</Table>Name the table with a <caption> (visually hidden, read out) or aria-label. Use header cells in TableHeader, and numeric on every cell of a column of amounts, counts or dates so the figures line up.
The table sits in a scroll container with a hairline border, so a wide table scrolls sideways on a small screen instead of widening the page.
Examples
Selection
selected gives a row the accent subtle background. It is visual only: put a Checkbox in the row so keyboard and screen reader users can select it, and a header checkbox that shows the mixed state.
| Name | Role | ||
|---|---|---|---|
| Mara Okafor | mara@northwind.studio | Owner | |
| Jonas Weber | jonas@northwind.studio | Admin | |
| Priya Raman | priya@northwind.studio | Editor | |
| Léa Martin | lea@northwind.studio | Viewer |
1 of 4 selected
Loading and empty
While data loads, keep the header and fill the rows with skeletons the width of the data, so nothing shifts when it arrives. With no rows, span one cell across the table and put an empty state in it.
| Invoice | Client | Amount |
|---|---|---|
Accessibility
| Key | Action |
|---|---|
| Tab and Shift+Tab | Move between the interactive elements in the table, such as checkboxes and links. Rows and cells aren't tab stops. |
| Space | Toggles the focused row checkbox. |
- Native table semantics: screen readers announce the column header for each cell and let people move by row and column.
TableCell headerrenders<th scope="col">. Usescope="row"on the first cell when it names the row, such as an invoice number.- Row hover is a visual aid only; never put the only way to an action in a hover state.
- Status in a cell uses a
Badgewith a text label, so it doesn't rely on colour.
API reference
Every part accepts className and renders a data-aloxe attribute you can target in CSS, such as [data-aloxe="table-row"]. Other props go to the native element.
Table
Extends <table>.
| Prop | Type | Default | Description |
|---|---|---|---|
| containerClassName | string | Classes for the scroll container around the table: border, radius, max width or height. | |
| aria-label | string | Names the table when it has no <caption>. A caption is visually hidden but read out. | |
| className | string | Classes for the <table> element. |
TableHeader
Extends <thead>.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | Merged with the default classes (raised surface). |
TableBody
Extends <tbody>.
| Prop | Type | Default | Description |
|---|---|---|---|
| className | string | Merged with the default classes. Rows show the hover overlay under the pointer. |
TableRow
Extends <tr>.
| Prop | Type | Default | Description |
|---|---|---|---|
| selected | boolean | false | Accent subtle background and data-selected. Visual only: convey selection with a checkbox in the row. |
| className | string | Merged with the default classes. |
TableCell
Extends <td> or <th>.
| Prop | Type | Default | Description |
|---|---|---|---|
| header | boolean | false | Renders a <th> with Label Sm. Use it in TableHeader, and for the first cell that names a row. |
| scope | "col" | "row" | "colgroup" | "rowgroup" | "col" | With header: "row" makes a row header in Label Md and the primary text colour. |
| numeric | boolean | false | Right-aligns the cell and uses tabular figures, for amounts, counts and dates. |
| colSpan | number | Spans several columns, such as an empty state across the whole table. | |
| className | string | Merged with the default classes. Add max-w-* and truncate to cut long text. |
Figma
Matches the Table and Table row components in the Pro Figma file. Table row Kind maps as follows: Header is a row in TableHeader, Default and Hover are rows in TableBody, Selected is selected.
See Figma for where to get the file and how its names map to code.
Pro
Table is part of Aloxe Pro. The previews on this page are open to everyone; the Code tab shows the example source once you sign in with a Pro license. See Access and licenses and Pricing.