npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-table.json --yesTable
ProA table of records compared across columns, for React and Tailwind CSS. Part of Goop Pro.
What an agent sees
- TableCaptionThe table's name, its first child
- TableHeaderThe header's row group (
thead) - TableBodyThe body's row group (
tbody) - TableFooterThe table's foot (
tfoot), after the body, pinned at the frame's foot while the rows scroll (give the table a height) - TableFooterBarThe foot's bar for the pager
- TableGroupRows of a table gathered under a band, such as interviews by status
- TableRowOne row (
tr) - TableHeadA head cell (
th)
import { TableCaption, TableFooter, TableFooterBar, TableGroup } from '@/components/ui/goop/table';
import { Avatar } from '@/components/ui/goop/avatar';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/goop/table';
import { TableCell } from '@/components/ui/goop/table-cell';
const CREW = [
{ id: 'teodora', name: 'Teodora Valk', email: 'teodora@fieldwork.test', role: 'Admin' },
{ id: 'bilal', name: 'Bilal Rashed', email: 'bilal@fieldwork.test', role: 'Member' },
];
function Crew({ onMore, onSort }: { onMore: (id: string) => void; onSort: () => void }) {
return (
<Table aria-label="Crew" className="max-h-96">
<TableHeader sticky>
<TableRow>
<TableHead className="w-full" sorted="ascending" onSort={onSort}>
Member
</TableHead>
<TableHead>Role</TableHead>
<TableHead align="end">Actions</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{CREW.map((person) => (
<TableRow key={person.id}>
<TableCell>
<span className="flex items-center gap-2">
<Avatar variant="solid" size="sm" hue="neutral" name={person.name}>
{person.name.slice(0, 1)}
</Avatar>
{person.email}
</span>
</TableCell>
<TableCell className="text-muted-foreground">{person.role}</TableCell>
<TableCell align="end">
<IconButton aria-label={`More for ${person.name}`} className="ms-auto" onClick={() => onMore(person.id)}>
<IconButtonIcon icon="ellipsis" />
</IconButton>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}Pick a look. Sortable: sort by any column with its sort control (press again to turn it), show only unpaid invoices, remove a row and Undo it back into its place. Grouped: the invoices under a band per status, each counting its rows; a click on a band or Enter on its caret folds it, said beside the filter. Display: the Display menu picks the columns, the grouping, the sort and the density, staying open between picks. Foot: sixteen invoices in a table of fixed height, its rows scrolling under the pinned totals and pager. Narrow the stage under 641 px and the status and due columns leave, each invoice name opening its whole record. The sort, the filter, the grouping and the pages are the example’s own: the table draws whatever rows it is handed, in that order.
When to use
- A table of records compared across columns.
- Also called: data table or data grid.
Installation
Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Table on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing. As a Pro part, its command comes from Goop's server once you sign in, with a one-time link that lasts ten minutes.
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-table.json --yesAdd the Goop Table to this project. The install steps are at https://goop.so/docs/install.mdUsage
import { TableCaption, TableFooter, TableFooterBar, TableGroup } from '@/components/ui/goop/table';
import { Avatar } from '@/components/ui/goop/avatar';
import { IconButton, IconButtonIcon } from '@/components/ui/goop/icon-button';
import { Table, TableBody, TableHead, TableHeader, TableRow } from '@/components/ui/goop/table';
import { TableCell } from '@/components/ui/goop/table-cell';
const CREW = [
{ id: 'teodora', name: 'Teodora Valk', email: 'teodora@fieldwork.test', role: 'Admin' },
{ id: 'bilal', name: 'Bilal Rashed', email: 'bilal@fieldwork.test', role: 'Member' },
];
function Crew({ onMore, onSort }: { onMore: (id: string) => void; onSort: () => void }) {
return (
<Table aria-label="Crew" className="max-h-96">
<TableHeader sticky>
<TableRow>
<TableHead className="w-full" sorted="ascending" onSort={onSort}>
Member
</TableHead>
<TableHead>Role</TableHead>
<TableHead align="end">Actions</TableHead>
</TableRow>
</TableHeader>
<TableBody>
{CREW.map((person) => (
<TableRow key={person.id}>
<TableCell>
<span className="flex items-center gap-2">
<Avatar variant="solid" size="sm" hue="neutral" name={person.name}>
{person.name.slice(0, 1)}
</Avatar>
{person.email}
</span>
</TableCell>
<TableCell className="text-muted-foreground">{person.role}</TableCell>
<TableCell align="end">
<IconButton aria-label={`More for ${person.name}`} className="ms-auto" onClick={() => onMore(person.id)}>
<IconButtonIcon icon="ellipsis" />
</IconButton>
</TableCell>
</TableRow>
))}
</TableBody>
</Table>
);
}- Fits: list: collection (fields: many).
- More on where it goes: table--options.md
API reference
- Each option with its sentence: table--options.md
| Part | What it is |
|---|---|
| TableCaption | The table's name, its first child |
| TableHeader | The header's row group (thead); put one TableRow of TableHead cells in it |
| TableBody | The body's row group (tbody); put one TableRow per record in it, keyed by its record's id, or one TableGroup per group |
| TableFooter | The table's foot (tfoot), after the body, pinned at the frame's foot while the rows scroll (give the table a height); put a totals TableRow (a TableHead naming it, a TableCell numeric per figure) and a TableFooterBar with the pager in it, either or both |
| TableFooterBar | The foot's bar for the pager |
| TableGroup | Rows of a table gathered under a band, such as interviews by status |
| TableRow | One row (tr) |
| TableHead | A head cell (th) |
TableBody
The body's row group (tbody); put one TableRow per record in it, keyed by its record's id, or one TableGroup per group.
import { TableBody } from '@/components/ui/goop/table';Options
TableCaption
The table's name, its first child.
import { TableCaption } from '@/components/ui/goop/table';Options
TableGroup
Rows of a table gathered under a band, such as interviews by status.
import { TableGroup } from '@/components/ui/goop/table';Options
- value: string — The group's key (its status, its person's id): the table keeps the group's fold by it.
- title: string — The group's name, on the band and as its caret's spoken name.
- count?: number — How many rows the group holds, after its name; left out, no count.
- mark?: ReactNode — A mark before the name (a StatusMark, an avatar), decorative: the name says it.
- defaultOpen?: boolean = true — Whether the rows show at first, left to the group (open unless
false). - open?: boolean — Whether the rows show, held by the caller with
onOpenChange. - onOpenChange?: (open: boolean) => void — Called with the rows' new state when the band folds or unfolds them.
TableHead
A head cell (th).
import { TableHead } from '@/components/ui/goop/table';Options
- align?: 'start' | 'end' — Where the cell lays what it holds:
start(the default) orend, a row's action on the table's end edge; give the column's head the same. - numeric?: boolean — A column of figures: one width each, laid at the column's end; give its head the same.
- wrap?: boolean — Wrap the cell's words onto more lines (the row grows) instead of holding them on one; give the column's head the same.
- sorted?: TableSort — On the column the rows are ordered by, and which way; a
TableCellSortin the head reads it. - onSort?: () => void — Make the head's words its column's sort button, called on each press (order the rows there).
- Also takes: asChild?: boolean
TableHeader
The header's row group (thead); put one TableRow of TableHead cells in it.
import { TableHeader } from '@/components/ui/goop/table';Options
- sticky?: boolean = false — Hold the header in view while the rows scroll under it, inside the table's frame (give the table a height).
Table: every option
import { Table } from '@/components/ui/goop/table';Compose
- Straight in an outline Card, under its CardHeader, a plain table takes the card's gutter by itself; never put it in a CardContent.
- TableGroup: Group by one key the rows share (a status, a person), in that key's own order, each with its rows' count; leave out an empty group. A sort orders the rows inside each group.
Options
- variant?: TableVariant = 'outline' — The look:
outline, the outlined box of a settings list (the default), orplain, a comparison's rows with no box. - gutter?: TableGutter — A plain table's insets before its first column and after its last:
none(the table's edge),pagethe page's 40 px gutter (a table across a page's panel),carda card's 12 px inset (a table in a Card). - density?: TableDensity = 'comfortable'
- columns?: string | ReadonlyArray<string | TableColumn> — Trail's column tracks, taken so a page written for Trail compiles: Meadow sizes each column by what it holds.
- Types: TableColumn = { track: string; hide?: 'narrow' }
TableRow
One row (tr).
import { TableRow } from '@/components/ui/goop/table';Options
Keyboard
| Key | What it does |
|---|---|
| Tab | Move to each row's menu button in turn (the comparison's plan buttons first); the table itself takes no stop |
| Enter/Space/ArrowDown on a row's menu button | Open its menu: make the person an admin or a member, or remove them |
| Enter/Space on a plan's button | Make that plan the current one: its button says so and rests |
Accessibility
- The native element answers the keyboard.
Responsive behaviour
- A column is as wide as what it holds, its words on one line: give the column that should take the room left a
className="w-full"on its head (a members list's names).columnsis Trail's prop: its tracks go unused, but a{ track, hide: 'narrow' }column leaves under 640 px of the table's width or where the columns overflow it (a phone, a narrow panel). A row's action (a menu'sIconButton) goes in the row's last cell,align="end"; the row lights under the pointer and its button takes the keyboard's Tab. Rows in groups: oneTableGroupper group in theTableBody, its rows inside it; totals and the pager: aTableFooterafter the body; a denser table:density="compact".
Notes for AI
Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.