Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-table.json --yes

Table

Pro

A data table of records compared across columns, with a header row whose columns can sort, for React and Tailwind CSS. Part of Goop Pro.

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 data table of records compared across columns, with a header row whose columns can sort.
  • Also called: data table or data grid.

When not to use

  • For a simple list of rows use Item.

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.

Terminal
npx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-table.json --yes
PROMPT
Add the Goop Table to this project. The install steps are at https://goop.so/docs/install.md

Usage

TSX
import { Table, TableHeader, TableBody, TableGroup, TableFooter, TableFooterBar, TableRow, TableHead } from '@/components/ui/goop/table';
import { TableCellSort, TableCellLabel, TableCell } from '@/components/ui/goop/table-cell';
import { Link } from '@/components/ui/goop/link';

<Table columns={['minmax(160px, 1fr)', { track: '120px', hide: 'narrow' }, '96px', { track: '82px', hide: 'narrow' }]}>
  <TableHeader>
    <TableRow>
      <TableHead sorted="ascending">
        <TableCellSort>Project</TableCellSort>
      </TableHead>
      <TableHead>
        <TableCellLabel>Owner</TableCellLabel>
      </TableHead>
      <TableHead>
        <TableCellLabel>Status</TableCellLabel>
      </TableHead>
      <TableHead>
        <TableCellLabel>Last edit</TableCellLabel>
      </TableHead>
    </TableRow>
  </TableHeader>
  <TableBody>
    <TableRow>
      <TableCell>
        <Link variant="cell" href="/projects/transcript-search">
          Transcript search
        </Link>
      </TableCell>
      <TableCell>
        <TableCellLabel>Teodora Valk</TableCellLabel>
      </TableCell>
      <TableCell>
        <TableCellLabel>In progress</TableCellLabel>
      </TableCell>
      <TableCell>
        <TableCellLabel>13 Nov</TableCellLabel>
      </TableCell>
    </TableRow>
  </TableBody>
</Table>
  • Fits: list, states (their recipes); list: collection (fields: many).
  • By default the first column starts on the table's start edge, in line with the words around it. Where the table spans a page's whole panel under its heading (a ListPage, a default PageBody) ask for gutter="page": its first column starts on the heading's edge. Straight in an outline Card, under its CardHeader, it takes the card's gutter by itself (gutter="card", said or not); never put it in a CardContent. Never leave a first track empty for a gutter, and never pad a wrapper round the table. Cells have no padding of their own; every column but a row's last keeps 24 px before the next: give a column a track 24 px wider than its words.
  • More on where it goes: table--options.md
  • height, width, padding, gap, border, background, text, motion: add no class for these.

API reference

Parts
PartWhat it is
TableHeaderThe sticky group above the rows; put one TableRow of TableHead cells in it
TableBodyThe group of data rows under the header; put one TableRow per record in it, each with a key that stays with its record (its id, never its place in the list)
TableGroupRows of a table gathered under a band, such as issues by status; its props: table--group.md
TableFooterThe table's foot, pinned at its end while the rows scroll; put a totals TableRow and a TableFooterBar with the pager in it
TableFooterBarThe foot's bar for the pager; summary?: ReactNode — The rows shown and of how many ("11–20 of 24"), at the bar's start
TableRowOne row of cells; TableHead cells in the header's row, TableCell cells in a body row
TableHeadOne column's header cell, in the header's row; set sorted on the column the rows follow, numeric on an amount column; sorted?: 'ascending' | 'descending' — On the column the rows are ordered by, and which way; also takes numeric?: boolean = false; align?: 'start' | 'end' = 'start'; wrap?: boolean = false
  • data-slot values (to select a part by): table, table-body, table-footer, table-footer-bar, table-footer-summary, table-frame, table-group, table-group-count, table-group-header, table-group-mark, table-group-name, table-group-rows, table-group-title, table-header, table-row

TableGroup

Rows of a table gathered under a band, such as issues 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.

Table: every option

TSX
import { Table } from '@/components/ui/goop/table';

Compose

  • An amount column: numeric; a row's actions menu on the table's end edge: align="end" on its head and cells. A column of Badges: the track auto, never a guessed px width (a fixed track cuts a wider pill's words). On a phone, give columns as a list and mark what can go ({ track: '120px', hide: 'narrow' }): under 640 px of the table's own width, or where the columns overflow it (a narrow panel), those columns leave, heads, cells and tracks. Keep the row's name and the one or two values a reader scans, and link the name to the record (Link variant="cell"). 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" (32 px rows).
  • TableGroup: Group by one key the rows share (a status, an assignee), 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

  • columns: string | ReadonlyArray<string | TableColumn> — The columns' tracks, a grid-template-columns value (3fr 2fr 140px) or a list of one track per column, one that leaves on a narrow table as { track, hide: 'narrow' } (['minmax(160px, 1fr)', { track: '120px', hide: 'narrow' }, '82px']); the gutters are the table's.
  • gutter?: 'none' | 'page' | 'card' — The tracks before the first column and after the last: none; page the page gutter (24 px), the table spanning a page's panel; or card a card's inset (16 px), the table in a Card.
  • density?: 'comfortable' | 'compact' = 'comfortable' — The rows' height: comfortable (44 px rows) or compact (32 px rows, a group's band 32 px; a touch screen keeps 44 px), the choice a Display menu offers.
  • Another example of it: table-cell.md
  • Types: TableColumn = { track: string; hide?: 'narrow' }

Accessibility

  • hover, active, focus-visible: the browser's own (:hover, :active, :focus-visible): write nothing

Its states are drawn from attributes and props, so assistive technology and your agent read the same thing:

StateDrawn by
expandedthe attribute data-state=open
openthe attribute data-state=open

Motion

  • The part sets its own motion: add no transition or animation of your own.
  • How the theme moves, and how to move your own parts the same way: Motion.

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.

goop.so/themes/trail/components/table.md · the page as Markdown
Theme
Install with your agentnpx shadcn@4.23.1 add https://registry.goop.so/g/<link>/trail-table.json --yes

Where would you like to start?

Free · now

The Goop plugin

A design system for your AI coding agent, so screen ten matches screen one.

/plugin marketplace add goop-so/skillsthen /plugin install goop@goopCodex, Cursor, ChatGPT, the Claude app and more: Connect Goop
FreePro

The components

Every part live, with its props, its keys and what an agent sees. Whole page and app templates, working with sample data.