Components

Table

A responsive table component.

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

Installation

Cortexcn
pnpm dlx shadcn@latest add @cortexcn/table

Usage

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

Examples

Basic

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
import { Table, TableBody, TableCaption, TableCell, TableHead, TableHeader, TableRow } from "@/components/table"const invoices = [  {    invoice: "INV001",    paymentStatus: "Paid",    totalAmount: "$250.00",    paymentMethod: "Credit Card",  },  {    invoice: "INV002",    paymentStatus: "Pending",    totalAmount: "$150.00",    paymentMethod: "PayPal",  },  {    invoice: "INV003",    paymentStatus: "Unpaid",    totalAmount: "$350.00",    paymentMethod: "Bank Transfer",  },  {    invoice: "INV004",    paymentStatus: "Paid",    totalAmount: "$450.00",    paymentMethod: "Credit Card",  },  {    invoice: "INV005",    paymentStatus: "Paid",    totalAmount: "$550.00",    paymentMethod: "PayPal",  },  {    invoice: "INV006",    paymentStatus: "Pending",    totalAmount: "$200.00",    paymentMethod: "Bank Transfer",  },  {    invoice: "INV007",    paymentStatus: "Unpaid",    totalAmount: "$300.00",    paymentMethod: "Credit Card",  },]export function TableBasic() {  return (    <div className="flex flex-col gap-6">      <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.slice(0, 3).map((invoice) => (            <TableRow key={invoice.invoice}>              <TableCell className="font-medium">{invoice.invoice}</TableCell>              <TableCell>{invoice.paymentStatus}</TableCell>              <TableCell>{invoice.paymentMethod}</TableCell>              <TableCell className="text-right">                {invoice.totalAmount}              </TableCell>            </TableRow>          ))}        </TableBody>      </Table>    </div>  )}
A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
Total$2,500.00
import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@/components/table"const invoices = [  {    invoice: "INV001",    paymentStatus: "Paid",    totalAmount: "$250.00",    paymentMethod: "Credit Card",  },  {    invoice: "INV002",    paymentStatus: "Pending",    totalAmount: "$150.00",    paymentMethod: "PayPal",  },  {    invoice: "INV003",    paymentStatus: "Unpaid",    totalAmount: "$350.00",    paymentMethod: "Bank Transfer",  },  {    invoice: "INV004",    paymentStatus: "Paid",    totalAmount: "$450.00",    paymentMethod: "Credit Card",  },  {    invoice: "INV005",    paymentStatus: "Paid",    totalAmount: "$550.00",    paymentMethod: "PayPal",  },  {    invoice: "INV006",    paymentStatus: "Pending",    totalAmount: "$200.00",    paymentMethod: "Bank Transfer",  },  {    invoice: "INV007",    paymentStatus: "Unpaid",    totalAmount: "$300.00",    paymentMethod: "Credit Card",  },]export function TableWithFooter() {  return (    <div className="flex flex-col gap-6">      <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.slice(0, 3).map((invoice) => (            <TableRow key={invoice.invoice}>              <TableCell className="font-medium">{invoice.invoice}</TableCell>              <TableCell>{invoice.paymentStatus}</TableCell>              <TableCell>{invoice.paymentMethod}</TableCell>              <TableCell className="text-right">                {invoice.totalAmount}              </TableCell>            </TableRow>          ))}        </TableBody>        <TableFooter>          <TableRow>            <TableCell colSpan={3}>Total</TableCell>            <TableCell className="text-right">$2,500.00</TableCell>          </TableRow>        </TableFooter>      </Table>    </div>  )}

Simple

NameEmailRole
Sarah Chensarah.chen@acme.comAdmin
Marc Rodriguezmarcus.rodriguez@acme.comUser
Emily Watsonemily.watson@acme.comUser
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/table"export function TableSimple() {  return (    <div className="flex flex-col gap-6">      <Table>        <TableHeader>          <TableRow>            <TableHead>Name</TableHead>            <TableHead>Email</TableHead>            <TableHead className="text-right">Role</TableHead>          </TableRow>        </TableHeader>        <TableBody>          <TableRow>            <TableCell className="font-medium">Sarah Chen</TableCell>            <TableCell>sarah.chen@acme.com</TableCell>            <TableCell className="text-right">Admin</TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Marc Rodriguez</TableCell>            <TableCell>marcus.rodriguez@acme.com</TableCell>            <TableCell className="text-right">User</TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Emily Watson</TableCell>            <TableCell>emily.watson@acme.com</TableCell>            <TableCell className="text-right">User</TableCell>          </TableRow>        </TableBody>      </Table>    </div>  )}

With badges

TaskStatusPriority
Design homepageCompletedHigh
Implement APIIn ProgressMedium
Write testsPendingLow
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/table"export function TableWithBadges() {  return (    <div className="flex flex-col gap-6">      <Table>        <TableHeader>          <TableRow>            <TableHead>Task</TableHead>            <TableHead>Status</TableHead>            <TableHead className="text-right">Priority</TableHead>          </TableRow>        </TableHeader>        <TableBody>          <TableRow>            <TableCell className="font-medium">Design homepage</TableCell>            <TableCell>              <span className="inline-flex items-center rounded-full bg-green-500/10 px-2 py-1 text-xs font-medium text-green-700 dark:text-green-400">                Completed              </span>            </TableCell>            <TableCell className="text-right">              <span className="inline-flex items-center rounded-full bg-blue-500/10 px-2 py-1 text-xs font-medium text-blue-700 dark:text-blue-400">                High              </span>            </TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Implement API</TableCell>            <TableCell>              <span className="inline-flex items-center rounded-full bg-yellow-500/10 px-2 py-1 text-xs font-medium text-yellow-700 dark:text-yellow-400">                In Progress              </span>            </TableCell>            <TableCell className="text-right">              <span className="inline-flex items-center rounded-full bg-gray-500/10 px-2 py-1 text-xs font-medium text-gray-700 dark:text-gray-400">                Medium              </span>            </TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Write tests</TableCell>            <TableCell>              <span className="inline-flex items-center rounded-full bg-gray-500/10 px-2 py-1 text-xs font-medium text-gray-700 dark:text-gray-400">                Pending              </span>            </TableCell>            <TableCell className="text-right">              <span className="inline-flex items-center rounded-full bg-gray-500/10 px-2 py-1 text-xs font-medium text-gray-700 dark:text-gray-400">                Low              </span>            </TableCell>          </TableRow>        </TableBody>      </Table>    </div>  )}

With actions

ProductPriceActions
Wireless Mouse$29.99
Mechanical Keyboard$129.99
USB-C Hub$49.99
import { Button } from "@/components/button"import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuSeparator, DropdownMenuTrigger } from "@/components/dropdown-menu"import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/table"import { MoreHorizontalIcon } from "lucide-react"export function TableWithActions() {  return (    <div className="flex flex-col gap-6">      <Table>        <TableHeader>          <TableRow>            <TableHead>Product</TableHead>            <TableHead>Price</TableHead>            <TableHead className="text-right">Actions</TableHead>          </TableRow>        </TableHeader>        <TableBody>          <TableRow>            <TableCell className="font-medium">Wireless Mouse</TableCell>            <TableCell>$29.99</TableCell>            <TableCell className="text-right">              <DropdownMenu>                <DropdownMenuTrigger asChild>                  <Button variant="ghost" size="icon" className="size-8">                    <MoreHorizontalIcon />                    <span className="sr-only">Open menu</span>                  </Button>                </DropdownMenuTrigger>                <DropdownMenuContent align="end">                  <DropdownMenuItem>Edit</DropdownMenuItem>                  <DropdownMenuItem>Duplicate</DropdownMenuItem>                  <DropdownMenuSeparator />                  <DropdownMenuItem variant="destructive">                    Delete                  </DropdownMenuItem>                </DropdownMenuContent>              </DropdownMenu>            </TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Mechanical Keyboard</TableCell>            <TableCell>$129.99</TableCell>            <TableCell className="text-right">              <DropdownMenu>                <DropdownMenuTrigger asChild>                  <Button variant="ghost" size="icon" className="size-8">                    <MoreHorizontalIcon />                    <span className="sr-only">Open menu</span>                  </Button>                </DropdownMenuTrigger>                <DropdownMenuContent align="end">                  <DropdownMenuItem>Edit</DropdownMenuItem>                  <DropdownMenuItem>Duplicate</DropdownMenuItem>                  <DropdownMenuSeparator />                  <DropdownMenuItem variant="destructive">                    Delete                  </DropdownMenuItem>                </DropdownMenuContent>              </DropdownMenu>            </TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">USB-C Hub</TableCell>            <TableCell>$49.99</TableCell>            <TableCell className="text-right">              <DropdownMenu>                <DropdownMenuTrigger asChild>                  <Button variant="ghost" size="icon" className="size-8">                    <MoreHorizontalIcon />                    <span className="sr-only">Open menu</span>                  </Button>                </DropdownMenuTrigger>                <DropdownMenuContent align="end">                  <DropdownMenuItem>Edit</DropdownMenuItem>                  <DropdownMenuItem>Duplicate</DropdownMenuItem>                  <DropdownMenuSeparator />                  <DropdownMenuItem variant="destructive">                    Delete                  </DropdownMenuItem>                </DropdownMenuContent>              </DropdownMenu>            </TableCell>          </TableRow>        </TableBody>      </Table>    </div>  )}

With select

TaskAssigneeStatus
Design homepageIn Progress
Implement APIPending
Write testsNot Started
import { Select, SelectContent, SelectGroup, SelectItem, SelectTrigger, SelectValue } from "@/components/select"import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/table"export function TableWithSelect() {  return (    <div className="flex flex-col gap-6">      <Table>        <TableHeader>          <TableRow>            <TableHead>Task</TableHead>            <TableHead>Assignee</TableHead>            <TableHead>Status</TableHead>          </TableRow>        </TableHeader>        <TableBody>          <TableRow>            <TableCell className="font-medium">Design homepage</TableCell>            <TableCell>              <Select defaultValue="sarah">                <SelectTrigger className="w-40" size="sm">                  <SelectValue />                </SelectTrigger>                <SelectContent>                  <SelectGroup>                    <SelectItem value="sarah">Sarah Chen</SelectItem>                    <SelectItem value="marcus">Marc Rodriguez</SelectItem>                    <SelectItem value="emily">Emily Watson</SelectItem>                    <SelectItem value="david">David Kim</SelectItem>                  </SelectGroup>                </SelectContent>              </Select>            </TableCell>            <TableCell>In Progress</TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Implement API</TableCell>            <TableCell>              <Select defaultValue="marcus">                <SelectTrigger className="w-40" size="sm">                  <SelectValue />                </SelectTrigger>                <SelectContent>                  <SelectGroup>                    <SelectItem value="sarah">Sarah Chen</SelectItem>                    <SelectItem value="marcus">Marc Rodriguez</SelectItem>                    <SelectItem value="emily">Emily Watson</SelectItem>                    <SelectItem value="david">David Kim</SelectItem>                  </SelectGroup>                </SelectContent>              </Select>            </TableCell>            <TableCell>Pending</TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Write tests</TableCell>            <TableCell>              <Select defaultValue="emily">                <SelectTrigger className="w-40" size="sm">                  <SelectValue />                </SelectTrigger>                <SelectContent>                  <SelectGroup>                    <SelectItem value="sarah">Sarah Chen</SelectItem>                    <SelectItem value="marcus">Marc Rodriguez</SelectItem>                    <SelectItem value="emily">Emily Watson</SelectItem>                    <SelectItem value="david">David Kim</SelectItem>                  </SelectGroup>                </SelectContent>              </Select>            </TableCell>            <TableCell>Not Started</TableCell>          </TableRow>        </TableBody>      </Table>    </div>  )}

With input

ProductQuantityPrice
Wireless Mouse$29.99
Mechanical Keyboard$129.99
USB-C Hub$49.99
import { Input } from "@/components/input"import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/table"export function TableWithInput() {  return (    <div className="flex flex-col gap-6">      <Table>        <TableHeader>          <TableRow>            <TableHead>Product</TableHead>            <TableHead>Quantity</TableHead>            <TableHead>Price</TableHead>          </TableRow>        </TableHeader>        <TableBody>          <TableRow>            <TableCell className="font-medium">Wireless Mouse</TableCell>            <TableCell>              <Input                type="number"                defaultValue="1"                className="h-8 w-20"                min="0"              />            </TableCell>            <TableCell>$29.99</TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">Mechanical Keyboard</TableCell>            <TableCell>              <Input                type="number"                defaultValue="2"                className="h-8 w-20"                min="0"              />            </TableCell>            <TableCell>$129.99</TableCell>          </TableRow>          <TableRow>            <TableCell className="font-medium">USB-C Hub</TableCell>            <TableCell>              <Input                type="number"                defaultValue="1"                className="h-8 w-20"                min="0"              />            </TableCell>            <TableCell>$49.99</TableCell>          </TableRow>        </TableBody>      </Table>    </div>  )}

Adapted from the shadcn/ui Table (MIT).