--- title: Table description: A simple table component for displaying tabular data. --- ## Installation CLI Manual ```bash npx shadcn@latest add @coss/table ``` Copy and paste the following code into your project. Update the import paths to match your project setup. ## Usage ```tsx import { Table, TableBody, TableCaption, TableCell, TableFooter, TableHead, TableHeader, TableRow, } from "@/components/ui/table" ``` ```tsx Caption Header Header Cell Cell
``` ## API Reference ### Table The main table container component. Set `variant="card"` for a card-style table: separated borders, rounded corners, and row surfaces that read as cards. That pairs well with a [Frame](/ui/docs/components/frame) (page chrome) or [CardFrame](/ui/docs/components/card) (card shell with optional header actions). The default variant is a simpler row layout with standard borders. | Prop | Type | Default | | ----------- | ---------------------------- | ----------- | | `className` | `string` | | | `variant` | `"default"` \| `"card"` | `"default"` | ```tsx ......
``` ```tsx ......
``` ### TableHeader Header section of the table containing column headers. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Header ``` ### TableBody Body section of the table containing table rows and data. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Cell ``` ### TableFooter Footer section of the table. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Footer ``` ### TableRow A row in the table. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Cell ``` ### TableHead A header cell in the table. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Header ``` ### TableCell A data cell in the table. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Cell ``` ### TableCaption A caption for the table. | Prop | Type | Default | | ----------- | -------- | ------- | | `className` | `string` | | ```tsx Caption ``` ## Examples ### Card-style table Use `variant="card"` when the grid itself should look like a set of cards (for example dashboards or standalone tables without an outer frame). ### Table in CardFrame Put the table in [CardFrame](/ui/docs/components/card) so the grid sits inside the card shell (border, radius, clipping). Use `variant="card"` on `Table`. The example below is static markup—no row selection or TanStack. ### Table in Frame Wrap the table in a [Frame](/ui/docs/components/frame) for bordered app-surface framing. Use `variant="card"` on `Table` so rows keep the card-style treatment inside the frame. ### Data table with TanStack Use [TanStack Table](https://tanstack.com/table) with `variant="card"` when you need column definitions, row selection, and `flexRender` over the same table primitives. Add `@tanstack/react-table` to your project for headless state (sorting, pagination, selection) beyond static markup. ## Changelog - [Apr 12, 2026](/ui/docs/changelog#table) — `Table` adds optional `variant` (`default` or `card`)