Component guideEditable source

Table

Semantic table elements with consistent borders and spacing.

Original component docs
On this page4 sectionsBack to top

Use Table for tabular data with headers and related rows. It includes an overflow wrapper, but sorting, filtering, pagination, and selection are not built in. Use Data Table as a starting point for those behaviors.

Live preview
Loading preview...

#Installation

Complete the base setup. For manual installation:

npx shadcn@latest add https://neobrutal-ui.andongmin.com/r/table.json

#Usage

import {
  Table,
  TableCaption,
  TableHeader,
  TableBody,
  TableRow,
  TableHead,
  TableCell,
} from "@/components/ui/table";

export default function InvoiceTable() {
  return (
    <Table>
      <TableCaption>Recent workspace invoices</TableCaption>
      <TableHeader>
        <TableRow>
          <TableHead scope="col">Invoice</TableHead>
          <TableHead scope="col">Status</TableHead>
          <TableHead scope="col" className="text-right">
            Amount
          </TableHead>
        </TableRow>
      </TableHeader>
      <TableBody>
        <TableRow>
          <TableCell>INV-001</TableCell>
          <TableCell>Paid</TableCell>
          <TableCell className="text-right">$120.00</TableCell>
        </TableRow>
      </TableBody>
    </Table>
  );
}

#API reference

PartPurposeDefault
TableNative table in horizontal overflow wrapperFull width
TableHeader / TableBody / TableFooterthead, tbody, tfootSemantic elements
TableRowRow of cellstr
TableHead / TableCellHeader/data cell; native scope, colSpan, rowSpanth / td
TableCaptionAccessible visible table descriptioncaption

#Accessibility

Provide a caption or accessible name and appropriate header scopes. Align numbers consistently. Do not replace semantic cells with generic divs or make rows click-only controls. On mobile, keep the scroll region reachable without overflowing the whole page.