View fulldotdev/ui on GitHub

Table

A data table component that displays information in rows and columns.

Installation

npx shadcn@latest add @fulldev/table

Usage

import {
  Table,
  TableBody,
  TableCaption,
  TableCell,
  TableHead,
  TableHeader,
  TableRow,
} from "@/components/ui/table"
<Table>
  <TableCaption>A list of your recent invoices.</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead class="w-[100px]">Invoice</TableHead>
      <TableHead>Status</TableHead>
      <TableHead>Method</TableHead>
      <TableHead class="text-right">Amount</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell class="font-medium">INV001</TableCell>
      <TableCell>Paid</TableCell>
      <TableCell>Credit Card</TableCell>
      <TableCell class="text-right">$250.00</TableCell>
    </TableRow>
  </TableBody>
</Table>

Composition

Table
├── TableCaption
├── TableHeader
│   └── TableRow
│       └── TableHead
├── TableBody
│   └── TableRow
│       └── TableCell
└── TableFooter
    └── TableRow
        └── TableCell

Table wraps the table in a div with horizontal overflow, so wide tables scroll instead of breaking the layout.

Use TableFooter to add a footer to the table.

Actions

A table with a DropdownMenu of actions for each row.

Data Table

Build sorting, filtering and pagination on top of Table yourself. The TanStack Data Table is React only.

RTL

Set dir="rtl" on the Table or a parent element.

API Reference

Source: src/components/ui/table

Each part renders its native table element (table, thead, tbody, tfoot, tr, th, td, caption) with a matching data-slot and passes all other attributes through.