Table

A responsive table component.

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
INV006PendingBank Transfer$200.00
INV007UnpaidCredit Card$300.00
Total$2,500.00

Installation

pnpm dlx cubix@latest add table --base radix

Usage

Import
import {
  Table,
  TableBody,
  TableCaption,
  TableCell,
  TableHead,
  TableHeader,
  TableRow,
} from "@/components/cubix/table"
Example
<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>
    <TableRow>
      <TableCell className="font-medium">INV001</TableCell>
      <TableCell>Paid</TableCell>
      <TableCell>Credit Card</TableCell>
      <TableCell className="text-right">$250.00</TableCell>
    </TableRow>
  </TableBody>
</Table>

Composition

Use the following composition to build a Table:

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

Examples

Footer

Use the TableFooter component to add a footer to the table.

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
Total$2,500.00

Actions

A table showing actions for each row using a DropdownMenu component.

ProductPriceActions
Wireless Mouse$29.99
Mechanical Keyboard$129.99
USB-C Hub$49.99

Data Table

You can use the Table component to build more complex data tables. Combine it with @tanstack/react-table to create tables with sorting, filtering and pagination.

See the Data Table documentation for more information.

API Reference

Table

The scroll container and native table element.

PropTypeDefaultDescription
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).
childrenReact.ReactNode-TableHeader, TableBody, TableFooter, and TableCaption.

TableRow

PropTypeDefaultDescription
data-state"selected" | undefined-Marks the row as selected for highlight styles.
classNamestring-Additional Tailwind classes merged with the component styles (last one wins).