Table
A structured data display component with rows and columns.
| Project | Status | Team | Budget |
|---|---|---|---|
| Website Redesign | Frontend | $12,500 | |
| Mobile App | Mobile | $8,750 | |
| API Integration | Backend | $5,200 | |
| Database Migration | DevOps | $3,800 | |
| Security Audit | Security | $2,100 | |
| Total | $32,350 | ||
Installation
pnpm dlx shadcn@latest add @columbus/tableUsage
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.
| Project | Status | Team | Budget |
|---|---|---|---|
| Website Redesign | Frontend | $12,500 | |
| Mobile App | Mobile | $8,750 | |
| API Integration | Backend | $5,200 | |
| Database Migration | DevOps | $3,800 | |
| Security Audit | Security | $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