Skip to content
SevenOne

Search documentation

Search pages and components

Table

A responsive table. The header and rows are 44px (48px in Large), cells have 12px side padding, and wide tables scroll sideways on small screens.

Installation

npx shadcn@latest add @sevenone/table

Usage

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

Examples

Invoices

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
INV004PaidCredit Card$450.00
INV005PaidPayPal$550.00
Total$1,750.00
<Table>
  <TableCaption>A list of your recent invoices.</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead className="w-[100px]">Invoice</TableHead>
      <TableHead>Status</TableHead>
      <TableHead>Method</TableHead>
      <TableHead className="text-right">Amount</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    {invoices.map((invoice) => (
      <TableRow key={invoice.invoice}>
        <TableCell className="font-medium">{invoice.invoice}</TableCell>
        <TableCell>{invoice.status}</TableCell>
        <TableCell>{invoice.method}</TableCell>
        <TableCell className="text-right">{invoice.amount}</TableCell>
      </TableRow>
    ))}
  </TableBody>
  <TableFooter>
    <TableRow>
      <TableCell colSpan={3}>Total</TableCell>
      <TableCell className="text-right">$1,750.00</TableCell>
    </TableRow>
  </TableFooter>
</Table>

Selection and status

Rows with a checkbox, two lines of text and a status Badge. The checkbox column is 56px wide.

CustomerProjectStatusAmount
Olivia Martin
olivia@example.com
Website redesignDone$1,999.00
Liam Johnson
liam@example.com
Mobile appIn progress$3,450.00
Emma Brown
emma@example.com
Design systemBlocked$2,100.00
<TableRow data-state={selected ? "selected" : undefined}>
  <TableCell>
    <Checkbox aria-label="Select Website redesign" checked={selected} />
  </TableCell>
  <TableCell>
    <div className="font-medium">Olivia Martin</div>
    <div className="text-muted-foreground">olivia@example.com</div>
  </TableCell>
  <TableCell>Website redesign</TableCell>
  <TableCell>
    <Badge variant="success">Done</Badge>
  </TableCell>
  <TableCell className="text-right">$1,999.00</TableCell>
</TableRow>

Accessibility

  • Use TableHead for column titles, so screen readers announce them with each cell.
  • Keep the TableCaption: it tells everyone what the table is about.
  • Status in a cell is never color alone; the Badge always carries a word.
  • Give every row checkbox a label that names the row.