Component
Table
Presents rows and columns of data in an accessible HTML table.
Install
Run the CLI to copy the source into your project.
pnpm dlx @stalk-ui/cli add @stalk-ui/tableExamples
Live previews render through the docs app's PandaCSS codegen.
<Table.Root> <Table.Caption>Recent invoices.</Table.Caption> <Table.Header> <Table.Row> <Table.Head scope="col">Invoice</Table.Head> <Table.Head scope="col">Status</Table.Head> <Table.Head scope="col">Amount</Table.Head> </Table.Row> </Table.Header> <Table.Body> <Table.Row> <Table.Cell>INV-001</Table.Cell> <Table.Cell> <Badge tone="success" variant="subtle"> Paid </Badge> </Table.Cell> <Table.Cell>$250.00</Table.Cell> </Table.Row> <Table.Row> <Table.Cell>INV-002</Table.Cell> <Table.Cell> <Badge tone="warning" variant="subtle"> Pending </Badge> </Table.Cell> <Table.Cell>$150.00</Table.Cell> </Table.Row> </Table.Body> </Table.Root>
<Table.Root> <Table.Header> <Table.Row> <Table.Head scope="col">Name</Table.Head> <Table.Head scope="col">Role</Table.Head> </Table.Row> </Table.Header> <Table.Body> <Table.Row data-state="selected"> <Table.Cell>Ada Lovelace</Table.Cell> <Table.Cell>Owner</Table.Cell> </Table.Row> <Table.Row> <Table.Cell>Linus Torvalds</Table.Cell> <Table.Cell>Maintainer</Table.Cell> </Table.Row> </Table.Body> </Table.Root>
Props
Public component props extracted from the source TypeScript types.
| Prop | Type | Required | Default | Description |
|---|---|---|---|---|
| `detail` | `ReactNode` | Yes | - | Detail content revealed below the row, in a cell spanning \`colSpan\` columns. |
| `colSpan` | `number` | Yes | - | Number of columns the detail cell spans. |
| `open` | `boolean` | No | - | Controlled open state. |
| `defaultOpen` | `boolean` | No | - | Initial open state when uncontrolled. |
| `onOpenChange` | `(open: boolean) => void` | No | - | Called when the open state changes. |
| Prop | Type | Required | Default | Description |
| `label` | `string` | No | - | Accessible label for the toggle. Default \`"Toggle row details"\`. |
| Prop | Type | Required | Default | Description |
| `containerProps` | `HTMLAttributes<HTMLDivElement>` | No | - | Props applied to the scroll container wrapping the \`<table>\`. |
| `stickyHeader` | `boolean` | No | - | Keep the header rows pinned while the body scrolls. Pair with a max-height +<br />\`overflowY: 'auto'\` on \`containerProps\` to get the vertical scroll region.<br />Freeze individual columns by setting \`data-pinned="start" \ |
| `stickyFooter` | `boolean` | No | - | Keep the footer rows pinned to the bottom while the body scrolls (mirror of<br /> \`stickyHeader\`; same \`containerProps\` scroll requirement). |
Variants
Variant axes exposed by the underlying PandaCSS recipe or slot recipe.
| Variant | Values |
|---|---|
| `stickyHeader` | `true` |
| `stickyFooter` | `true` |
Registry
Files this component contributes to your registry install.
- Manifest: `/r/table.json`
- Recipe: `table`
- Files: `src/components/ui/table.tsx`