Table

A clear layout for structured rows and columns.

Display invoices, products, and other structured data in familiar rows and columns.

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
A list of your recent invoices.
tsx
import {  Table,  TableBody,  TableCaption,  TableCell,  TableHead,  TableHeader,  TableRow,} from "@/components/ui/table"const invoices = [  { invoice: "INV001", status: "Paid", method: "Credit Card", amount: "$250.00" },  { invoice: "INV002", status: "Pending", method: "PayPal", amount: "$150.00" },  { invoice: "INV003", status: "Unpaid", method: "Bank Transfer", amount: "$350.00" },  { invoice: "INV004", status: "Paid", method: "Credit Card", amount: "$450.00" },  { invoice: "INV005", status: "Paid", method: "PayPal", amount: "$550.00" },  { invoice: "INV006", status: "Pending", method: "Bank Transfer", amount: "$200.00" },  { invoice: "INV007", status: "Unpaid", method: "Credit Card", amount: "$300.00" },]export function Example() {  return (    <div>      <Table>        <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((row) => (            <TableRow key={row.invoice}>              <TableCell className="font-medium">{row.invoice}</TableCell>              <TableCell>{row.status}</TableCell>              <TableCell>{row.method}</TableCell>              <TableCell className="text-right">{row.amount}</TableCell>            </TableRow>          ))}        </TableBody>      </Table>      <TableCaption>A list of your recent invoices.</TableCaption>    </div>  )}

Installation

npx @arctis-sh/@arctis-sh/ui@latest add table

Usage

import {  Table,  TableBody,  TableCaption,  TableCell,  TableHead,  TableHeader,  TableRow,} from "@/components/ui/table"
<div>  <Table>    <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>  <TableCaption>Recent invoices.</TableCaption></div>

Composition

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

Add TableFooter for totals or other summary content below the body.

InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
Total$750.00
A list of your recent invoices.
tsx
import {  Table,  TableBody,  TableCaption,  TableCell,  TableFooter,  TableHead,  TableHeader,  TableRow,} from "@/components/ui/table"const invoices = [  { invoice: "INV001", status: "Paid", method: "Credit Card", amount: "$250.00" },  { invoice: "INV002", status: "Pending", method: "PayPal", amount: "$150.00" },  { invoice: "INV003", status: "Unpaid", method: "Bank Transfer", amount: "$350.00" },]export function Example() {  return (    <div>      <Table>        <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((row) => (            <TableRow key={row.invoice}>              <TableCell className="font-medium">{row.invoice}</TableCell>              <TableCell>{row.status}</TableCell>              <TableCell>{row.method}</TableCell>              <TableCell className="text-right">{row.amount}</TableCell>            </TableRow>          ))}        </TableBody>        <TableFooter>          <TableRow>            <TableCell colSpan={3}>Total</TableCell>            <TableCell className="text-right">$750.00</TableCell>          </TableRow>        </TableFooter>      </Table>      <TableCaption>A list of your recent invoices.</TableCaption>    </div>  )}

Actions

Place a DropdownMenu in a cell for actions that belong to a single row.

ProductPriceActions
Wireless Mouse$29.99
Mechanical Keyboard$129.99
USB-C Hub$49.99
tsx
import {  DropdownMenu,  DropdownMenuContent,  DropdownMenuItem,  DropdownMenuTrigger,} from "@/components/ui/dropdown-menu"import {  Table,  TableBody,  TableCell,  TableHead,  TableHeader,  TableRow,} from "@/components/ui/table"const products = [  { name: "Wireless Mouse", price: "$29.99" },  { name: "Mechanical Keyboard", price: "$129.99" },  { name: "USB-C Hub", price: "$49.99" },]export function Example() {  return (    <Table>      <TableHeader>        <TableRow>          <TableHead>Product</TableHead>          <TableHead>Price</TableHead>          <TableHead className="w-[70px] text-right">            <span className="sr-only">Actions</span>          </TableHead>        </TableRow>      </TableHeader>      <TableBody>        {products.map((product) => (          <TableRow key={product.name}>            <TableCell className="font-medium">{product.name}</TableCell>            <TableCell>{product.price}</TableCell>            <TableCell className="text-right">              <DropdownMenu>                <DropdownMenuTrigger                  aria-label="Open menu"                  className="inline-flex size-6 shrink-0 items-center justify-center rounded-sm text-foreground/50 transition-colors duration-200 ease-out hover:bg-surface-hover hover:text-foreground aria-expanded:bg-surface-hover aria-expanded:text-foreground"                >                  <MoreHorizontalIcon className="size-3.5" />                </DropdownMenuTrigger>                <DropdownMenuContent align="end">                  <DropdownMenuItem>Edit</DropdownMenuItem>                  <DropdownMenuItem>Duplicate</DropdownMenuItem>                  <DropdownMenuItem>Delete</DropdownMenuItem>                </DropdownMenuContent>              </DropdownMenu>            </TableCell>          </TableRow>        ))}      </TableBody>    </Table>  )}

Data Table

Need sorting, filtering, pagination, or row selection? See Data Table.

API Reference

Table

PropTypeDefault
classNamestring

Also accepts the other native table attributes.

<Table>  <TableHeader>    <TableRow>      <TableHead>Name</TableHead>    </TableRow>  </TableHeader>  <TableBody>    <TableRow>      <TableCell>Mina</TableCell>    </TableRow>  </TableBody></Table>

TableHeader

PropTypeDefault
classNamestring

Also accepts the other native thead attributes.

<TableHeader>  <TableRow>    <TableHead>Name</TableHead>  </TableRow></TableHeader>

TableBody

PropTypeDefault
classNamestring

Also accepts the other native tbody attributes.

<TableBody>  <TableRow>    <TableCell>Mina</TableCell>  </TableRow></TableBody>

TableFooter

PropTypeDefault
classNamestring

Also accepts the other native tfoot attributes.

<TableFooter>  <TableRow>    <TableCell>Total</TableCell>  </TableRow></TableFooter>

TableRow

PropTypeDefault
classNamestring

Also accepts the other native tr attributes. Set data-state="selected" for a selected row.

<TableRow>  <TableCell>Mina</TableCell></TableRow>

TableHead

PropTypeDefault
classNamestring

Also accepts the other native th attributes.

<TableHead>Name</TableHead>

TableCell

PropTypeDefault
classNamestring

Also accepts the other native td attributes.

<TableCell>Mina</TableCell>

TableCaption

Place TableCaption next to Table, not inside it.

PropTypeDefault
classNamestring

Also accepts the other native div attributes.

<TableCaption>A list of people.</TableCaption>