Table
Semantic tabular data with structured headers, cells, selection and interactive-row support.
Purpose
Use Table for genuinely tabular, scannable data whose columns need semantic headers and consistent alignment.
Card table
Installation
With the Siteplane registry alias configured, add the component and import the installed source from your app.
CLI
pnpm dlx shadcn@4.16.1 add @siteplane/tableImport
import { Table } from "@/components/ui/table";
import { TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow } from "@/components/ui/table";Need the machine-readable source metadata? View registry JSON.
Usage
Use Table for true tabular data. Use DataTable when the table needs managed sorting.
import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow } from "@/components/ui/table";
export function Example() {
return (
<Table>
<TableHeader><TableRow><TableHead>Customer</TableHead></TableRow></TableHeader>
<TableBody><TableRow><TableCell>Acme Co.</TableCell></TableRow></TableBody>
</Table>
);
}Examples
Captions, footers, row states, selection, loading and empty rows are compositions of the same slots.
Default
With caption
TableCaption describes the table for assistive technology and sighted readers.
Selected row
The native data-state="selected" row state highlights a row without extra markup.
Row selection
Row selection is a local composition: checkboxes drive the selected row state, an indeterminate select-all and the count.
Loading rows
Empty row
Inside CardFrame
CardFrame gives a card-variant table an app-surface frame without touching the table itself.
API Reference
The reference lists the source-owned exports and props that are easy to miss in visual examples. Inherited Base UI props remain available unless the wrapper narrows them.
- Compose
Table,TableHeader,TableBody,TableFooter,TableRow,TableHead,TableCellandTableCaption. Tableacceptsvariant="default" | "card"; the wrapper provides horizontal overflow through its native table container.- Set
data-state="selected"on a selected row. Setdata-interactive="true"on a clickable row to receive the native pointer and focus-visible treatment. - Use Data Table when sorting, accessor columns or controlled table behavior is required.
Motion
Component motion uses the shared Siteplane motion contract. See the global motion guide for provider setup, tokens and reduced-motion behavior.
- Table has no mount or row-entry animation. Hover, selected and interactive states use quiet tokenized state changes.
- Reduced motion needs no extra handling because rows do not translate or scale.
Accessibility
- Use real header cells, body cells and a caption when the surrounding context does not already name the table.
- Interactive rows need keyboard activation and a clear focus target; nested buttons or links must remain independently operable.
- Loading and empty rows should span the full column count.
Implementation Guidance
- Do not use Table as a general layout grid.
- Use
data-interactive="true"instead of rebuilding clickable-row cursor and focus styles. - Keep sorting and accessor logic in Data Table, not in the primitive Table.