---
title: "Table"
description: "Shows data in rows and columns with plain HTML table parts. Number columns line up, the head can stay at the top, and a wide table scrolls in its own box."
url: https://gelatinui.com/components/table
markdown_url: https://gelatinui.com/components/table.md
access: free
install: "npx shadcn@latest add @gelatin-ui/table"
registry_item: https://gelatinui.com/r/table.json
version: "2026-11-08"
index: https://gelatinui.com/llms.txt
docs_index: https://gelatinui.com/docs/llms.txt
---

# Table

> Shows data in rows and columns with plain HTML table parts. Number columns line up, the head can stay at the top, and a wide table scrolls in its own box.

Page: https://gelatinui.com/components/table

## When to use it

Best for: Rows and columns of data with no sort or filter state.

- Use it for data people read across.
- Use `numeric` on a head and its cells for numbers.
- Use `sticky` on `TableHeader` with a height on the scroll box.

## When not to use it

- For sort, selection, and pages, use a [Data Table](https://gelatinui.com/components/data-table.md).

## Notes for agents

- The parts are the native table elements.
- The table sits in a box that scrolls sideways, so a wide table never scrolls the page.
- Give the table a `min-w-*` class when its columns must not squeeze.
- `containerProps` goes to the scroll box.
- Cells do not wrap by default.

## Anatomy

```text
Table
├─ TableHeader (0..n)
├─ TableBody (0..n)
├─ TableFooter (0..n)
├─ TableRow (0..n)
├─ TableHead (0..n)
├─ TableCell (0..n)
└─ TableCaption (0..n)
```

## API reference

### Table

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `containerProps` | `Omit` |  | Props of the scroll box around the table. - `aria-label` / `aria-labelledby`: its name while it scrolls. Theirs wins over the caption. The component sets these only while the box scrolls, so a table that fits has no name on a plain `div`. - `className`: a height for a table that scrolls inside the box (`max-h-96`), with a `sticky` `TableHeader`. Other props (`id`, `data-*`, handlers) pass through. - `tabIndex` and `role` belong to the component: it sets them while the box scrolls. |

### TableHeader

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `sticky` | `boolean` | false | Keep the head cells at the top of the scroll box while the body scrolls under them. Give the table a height through `containerProps={{ className: "max-h-96" }}`. |

### TableBody

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TableFooter

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TableRow

No props of its own: `className`, `children`, and every other prop go to the element it renders.

### TableHead

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `"center" \| "end" \| "start"` |  |  |
| `numeric` | `boolean` |  |  |

### TableCell

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `"center" \| "end" \| "start"` |  |  |
| `numeric` | `boolean` |  |  |

### TableCaption

No props of its own: `className`, `children`, and every other prop go to the element it renders.

## Styling

| Part | Slot | States | CSS variables | Tokens |
| --- | --- | --- | --- | --- |
| Table | `table` |  |  |  |
| TableHeader | `table-header` |  |  |  |
| TableBody | `table-body` |  |  |  |
| TableFooter | `table-footer` |  |  |  |
| TableRow | `table-row` | `aria-expanded`, `aria-selected`, `data-state` |  |  |
| TableHead | `table-head` |  |  |  |
| TableCell | `table-cell` |  |  |  |
| TableCaption | `table-caption` |  |  |  |

## Usage

Use the parts as you use table elements.

```tsx title="invoices-table.tsx"
import {
  Table,
  TableBody,
  TableCell,
  TableHead,
  TableHeader,
  TableRow,
} from "@/components/ui/table";

export function InvoicesTable() {
  return (
    <Table>
      <TableHeader>
        <TableRow>
          <TableHead>Invoice</TableHead>
          <TableHead numeric>Amount</TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        <TableRow>
          <TableCell>INV-2041</TableCell>
          <TableCell numeric>$1,240.00</TableCell>
        </TableRow>
      </TableBody>
    </Table>
  );
}
```

## Compose

Rules:

- Compose the parts (`compose-parts`): Build each item from its named parts as children, and pass your text and icons in as parts.
- Every state is designed (`every-state`): Give each view of data its loading, empty, and error states: a skeleton in the final layout, an `Empty` with an illustration and one next action, and an error that says what failed and how to retry.

## Add it

```bash
npx shadcn@latest add @gelatin-ui/table
```

It adds 4 registry items: 4 files, 470 lines, and the npm packages `clsx`, `tailwind-merge`, `tailwind-variants`.

## For AI agents

- Every item, one file: https://gelatinui.com/llms.txt
- MCP server (`search_items`, `get_item`, `get_install_plan`): https://gelatinui.com/mcp

## Related

- [Data Table](https://gelatinui.com/components/data-table.md): Pick Data Table when people sort, filter, select, and page the records.
- [Frame](https://gelatinui.com/components/frame.md)
- [Empty](https://gelatinui.com/components/empty.md)
- [Data Grid](https://gelatinui.com/components/data-grid.md): Pick Data Grid (Pro) for many rows that people edit in cells, with paste, undo, and virtual rows.

## Keyboard

| Keys | Action |
| --- | --- |
| Left Arrow, Right Arrow | Scrolls a wide table when its box has focus. A table that fits adds no tab stop. |

## Accessibility

It renders real table elements, so a screen reader reads rows and columns.

A box that scrolls joins the tab order, so a keyboard user can scroll it.

`TableCaption` names the table.
