---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Table

A table of records compared across columns, for React and Tailwind CSS. Part of Goop Pro.

Pro. Its export: `Table`.

## Try it

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.

```sh
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/meadow-table.json --yes
```

```text
Add the Goop Table to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
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

### Parts

- `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.

```tsx
import { TableBody } from '@/components/ui/goop/table';
```

### Options

### TableCaption

The table's name, its first child.

```tsx
import { TableCaption } from '@/components/ui/goop/table';
```

### Options

### TableFooterBar

The foot's bar for the pager.

```tsx
import { TableFooterBar } from '@/components/ui/goop/table';
```

### Options

- summary?: ReactNode — The rows shown and of how many ("11–20 of 24"), at the bar's start.

### 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.

```tsx
import { TableFooter } from '@/components/ui/goop/table';
```

### Options

### TableGroup

Rows of a table gathered under a band, such as interviews by status.

```tsx
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`).

```tsx
import { TableHead } from '@/components/ui/goop/table';
```

### Options

- align?: 'start' | 'end' — Where the cell lays what it holds: `start` (the default) or `end`, 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 `TableCellSort` in 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.

```tsx
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

```tsx
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), or `plain`, 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), `page` the page's 40 px gutter (a table across a page's panel), `card` a 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`).

```tsx
import { TableRow } from '@/components/ui/goop/table';
```

### Options

## Keyboard

- 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). `columns` is 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's `IconButton`) 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: one `TableGroup` per group in the `TableBody`, its rows inside it; totals and the pager: a `TableFooter` after 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.

Shortened to fit: the data-slot values, how each state is put on, the states, what the part already sets.

## Related

- [Avatar](/themes/meadow/components/avatar): A person's or a team's picture or initials, beside their name or on its own.
- [Icon button](/themes/meadow/components/icon-button): A button whose one visible label is a pack icon, for toolbars, rows and headers, with a spoken name.
- [Table cell](/themes/meadow/components/table-cell): One cell of a data table: a value, optionally with an icon or a picture before it, inside a row.
- [Table selection](/themes/meadow/components/table-selection): A Table whose rows a person ticks to act on many at once, with a bar of bulk actions for the picked rows.
