Table
A data table with header, body and footer sections.
| Build | Branch | Status |
|---|---|---|
| #1284 | main | Ready |
| #1283 | fix/tokens | Building |
| #1282 | feat/docs | Failed |
Installation
npx shadcn@latest add @blank/tableUsage
import {
Table,
TableBody,
TableCaption,
TableCell,
TableHead,
TableHeader,
TableRow,
} from "@/components/ui/table"<Table>
<TableCaption>Recent invoices</TableCaption>
<TableHeader>
<TableRow>
<TableHead>Invoice</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>INV-001</TableCell>
<TableCell className="text-right">$250.00</TableCell>
</TableRow>
</TableBody>
</Table>Examples
Footer and caption
| Invoice | Method | Amount |
|---|---|---|
| INV-1042 | Card | $250.00 |
| INV-1043 | Bank transfer | $1,200.00 |
| INV-1044 | Card | $89.00 |
| Total | $1,539.00 | |
Selectable rows
Set data-state="selected" on a row and it takes the selection surface, the same one menus use.
| Name | Role | |
|---|---|---|
| Ada Park | Owner | |
| Jon Diaz | Editor | |
| Mia Chen | Viewer |
API Reference
Table, TableHeader, TableBody, TableFooter, TableRow, TableHead, TableCell, TableCaption
Each wraps its HTML element and takes every prop of it. Table sits in a horizontally scrolling container, so wide tables never break the page.