Skip to Content
Columbus

Table

A structured data display component with rows and columns.

A list of current projects.
ProjectStatusTeamBudget
Website RedesignPaidFrontend$12,500
Mobile AppUnpaidMobile$8,750
API IntegrationPendingBackend$5,200
Database MigrationPaidDevOps$3,800
Security AuditFailedSecurity$2,100
Total$32,350

Installation

pnpm dlx shadcn@latest add @columbus/table

Usage

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

<Table>
  <TableCaption>Team members</TableCaption>
  <TableHeader>
    <TableRow>
      <TableHead>Name</TableHead>
      <TableHead>Role</TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>Ada Lovelace</TableCell>
      <TableCell>Engineer</TableCell>
    </TableRow>
  </TableBody>
</Table>;

TableCaption names the table for screen readers. If you don't want a visible caption, give the table an aria-label.

Card

variant="card" gives the body rounded corners and a card surface.

ProjectStatusTeamBudget
Website RedesignPaidFrontend$12,500
Mobile AppUnpaidMobile$8,750
API IntegrationPendingBackend$5,200
Database MigrationPaidDevOps$3,800
Security AuditFailedSecurity$2,100
Total$32,350

Selected rows

Set data-state="selected" on a TableRow to highlight it.

API reference

Each part renders its HTML element (<table>, <thead>, <tbody>, <tfoot>, <tr>, <th>, <td>, <caption>) and accepts its attributes. Table wraps the <table> in a <div> that scrolls horizontally.

Prop

Type

On this page