Components
'use client';
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from '@/registry/san-francisco/ui/table';
export default function TableDemo() {
return (
<Table>
<TableHeader>
<TableRow>
<TableHead>Name</TableHead>
<TableHead>Status</TableHead>
<TableHead>Role</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>Alice</TableCell>
<TableCell>Active</TableCell>
<TableCell>Admin</TableCell>
</TableRow>
<TableRow>
<TableCell>Bob</TableCell>
<TableCell>Inactive</TableCell>
<TableCell>User</TableCell>
</TableRow>
</TableBody>
</Table>
);
}
bunx shadcn@latest add @sft-ui/table
'use client';
import {
Table,
TableBody,
TableCaption,
TableCell,
TableFooter,
TableHead,
TableHeader,
TableRow,
} from '@/registry/san-francisco/ui/table';
export default function TableDemoFooterCaption() {
return (
<Table>
<TableCaption>A list of recent invoices.</TableCaption>
<TableHeader>
<TableRow>
<TableHead>Invoice</TableHead>
<TableHead>Status</TableHead>
<TableHead className="text-right">Amount</TableHead>
</TableRow>
</TableHeader>
<TableBody>
<TableRow>
<TableCell>INV-001</TableCell>
<TableCell>Paid</TableCell>
<TableCell className="text-right">$250.00</TableCell>
</TableRow>
<TableRow>
<TableCell>INV-002</TableCell>
<TableCell>Pending</TableCell>
<TableCell className="text-right">$150.00</TableCell>
</TableRow>
</TableBody>
<TableFooter>
<TableRow>
<TableCell colSpan={2}>Total</TableCell>
<TableCell className="text-right">$400.00</TableCell>
</TableRow>
</TableFooter>
</Table>
);
}
Thin styled wrappers around native HTML table elements. Each component accepts its corresponding HTML attributes plus className.
| Component | HTML Element | Description |
|---|
Table | <table> | Root table wrapped in a scrollable container. |
TableHeader | <thead> | The table header section. |
TableBody | <tbody> | The table body section. |
TableFooter | <tfoot> | The table footer section. |
TableRow | <tr> | A table row with hover and selected states. |
TableHead | <th> | A header cell. |
TableCell | <td> | A data cell. |
TableCaption | <caption> | A table caption rendered below the table. |