Table

Styled table primitives for structured data, with header, body, footer, row, cell and caption parts on native table elements.

import { Table, TableHeader, TableBody, TableRow, TableHead, TableCell } from "@plexui/ui/components/Table";
import { DataTable, DataTableColumnHeader } from "@plexui/ui/components/DataTable";

Table Primitives

Overview

A list of your recent invoices.
InvoiceStatusMethodAmount
INV001PaidCredit Card$250.00
INV002PendingPayPal$150.00
INV003UnpaidBank Transfer$350.00
INV004PaidCredit Card$450.00
INV005PaidPayPal$550.00
Total$1,750.00
ProductQtyPriceTotal
Pro Plan3$29.00$87.00
Storage Add-on1$9.00$9.00
Subtotal$96.00

Minimal

NameTitleEmail
Lindsay WaltonFront-end Developerlindsay@example.com
Courtney HenryDesignercourtney@example.com
Tom CookDirector of Producttom@example.com

DataTable

The examples import users (15 rows) and its User type from a local ./data file. Header and cell renderers are functions that return JSX, rendered with TanStack Table's flexRender.

Variant

variant
RoleDepartmentStatus
Lindsay WaltonFront-end DeveloperEngineering
Active
Courtney HenryDesignerDesign
Active
Tom CookDirector of ProductProduct
Active
Whitney FrancisCopywriterMarketing
Inactive
Leonard KrasnerSenior DeveloperEngineering
Active
Floyd MilesUX ResearcherDesign
Active

Sorting

Alicia BellProduct ManagerActive
Anna RobertsBackend DeveloperActive
Benjamin RusselDevOps EngineerActive
Courtney HenryDesignerActive
Emily SelmanVP MarketingActive
Rows per page
1–5 of 15

Pagination

IDNameDepartmentStatus
USR-001Lindsay WaltonEngineeringActive
USR-002Courtney HenryDesignActive
USR-003Tom CookProductActive
USR-004Whitney FrancisMarketingInactive
USR-005Leonard KrasnerEngineeringActive
Rows per page
1–5 of 15

Row click

EmailRole
Lindsay Waltonlindsay@example.comFront-end Developer
Courtney Henrycourtney@example.comDesigner
Tom Cooktom@example.comDirector of Product
Whitney Franciswhitney@example.comCopywriter
Rows per page
1–4 of 8

Click a row to see selected user details.

Row selection

RoleStatus
Lindsay WaltonFront-end Developer
Active
Courtney HenryDesigner
Active
Tom CookDirector of Product
Active
Whitney FrancisCopywriter
Inactive
Leonard KrasnerSenior Developer
Active
Rows per page
1–5 of 15

0 of 15 rows selected

Cell variants

IDNameStatusJoinedSalary
USR-001Lindsay Walton
Active
Jan 15, 2023, 09:00 AM$95,000
USR-002Courtney Henry
Active
Mar 22, 2023, 09:00 AM$88,000
USR-003Tom Cook
Active
Jun 10, 2022, 09:00 AM$120,000
USR-004Whitney Francis
Inactive
Jul 4, 2023, 09:00 AM$72,000
USR-005Leonard Krasner
Active
Feb 18, 2022, 09:00 AM$115,000
USR-006Floyd Miles
Active
May 11, 2023, 09:00 AM$85,000
Rows per page
1–6 of 15

Filtering

RoleDepartmentStatus
Lindsay WaltonFront-end DeveloperEngineering
Active
Courtney HenryDesignerDesign
Active
Tom CookDirector of ProductProduct
Active
Whitney FrancisCopywriterMarketing
Inactive
Leonard KrasnerSenior DeveloperEngineering
Active
Rows per page
1–5 of 15

Column visibility

RoleDepartmentStatusSalary
Lindsay WaltonFront-end DeveloperEngineering
Active
$95,000
Courtney HenryDesignerDesign
Active
$88,000
Tom CookDirector of ProductProduct
Active
$120,000
Whitney FrancisCopywriterMarketing
Inactive
$72,000
Leonard KrasnerSenior DeveloperEngineering
Active
$115,000
Rows per page
1–5 of 15

Empty state

IDNameEmailStatus
No users found.

API

Table Primitives

PropTypeDefaultDescription
Tabletable—Root table container with horizontal scroll wrapper
TableHeaderthead—Table header group
TableBodytbody—Table body group
TableFootertfoot—Table footer group
TableRowtr—Table row
TableHeadth—Table header cell
TableCelltd—Table data cell
TableCaptioncaption—Table caption

Every part renders its native element, merges className after its own, and forwards all other props (colSpan, scope, onClick, ...).

DataTable

PropTypeDefaultDescription
columnsColumnDef<TData>[]—Column definitions following TanStack Table v8 API (required)
dataTData[]—Data array to display (required)
variant"default" | "bordered""default"Visual variant: bordered adds a rounded border and tinted header
pageSizenumber10Rows per page. Set 0 or Infinity to disable pagination. The rows-per-page select offers 10, 20, 50, 100 and this size
initialSortingSortingState—Initial column sorting state
globalFilterstring—Controlled search/filter string
onGlobalFilterChange(value: string) => void—Callback when filter changes
onRowClick(row: TData) => void—Click handler for rows. Makes rows interactive: they take Tab and call it on Enter or Space
columnVisibilityVisibilityState—Controlled column visibility state
onColumnVisibilityChange(visibility: VisibilityState) => void—Callback when visibility changes
enableRowSelectionbooleanfalseAdds a first column (id select) with a checkbox per row and a header checkbox that selects every row on all pages, mixed when some are selected. A click on a checkbox is not a row click
rowSelectionRowSelectionState—Controlled row selection state
onRowSelectionChange(selection: RowSelectionState) => void—Callback when selection changes
getRowId(row: TData) => string—Custom row ID accessor; selection keys use it
emptyMessageReactNode"No results."Shown when no rows
showPaginationbooleantrueWhether to show pagination controls. They hide on their own when every row fits on one page
classNamestring—Class applied to outermost wrapper

Column groups (a column definition with columns) render a header that spans its columns.

DataTableColumnHeader

PropTypeDefaultDescription
columnColumn<TData, TValue>—TanStack Table column object (required)
titlestring—Display text for the header (required)
classNamestring—Class applied to the header button (or text when the column cannot sort)

Column helpers

PropTypeDefaultDescription
idCell(accessor)CellComponent—Monospace ID with copy-on-click tooltip
dateTimeCell(accessor, options?)CellComponent—Formatted datetime with Intl.DateTimeFormat
statusCell(accessor, colorMap?)CellComponent—Badge cell with automatic status-to-color mapping
tooltipHeader(label, description)HeaderComponent—Header with dashed underline and info tooltip

Styling

Table reads these component tokens. Override them at any scope to restyle it:

  • --table-border-color: border color (default var(--color-border))
  • --table-caption-color: caption color (default var(--color-text-tertiary))
  • --table-caption-font-size: caption font size (default var(--font-text-sm-size))
  • --table-cell-color: cell color (default var(--color-text))
  • --table-cell-font-size: cell font size (default var(--font-text-sm-size))
  • --table-cell-line-height: cell line height (default var(--font-text-sm-line-height))
  • --table-cell-padding: cell padding (default spacing(3) spacing(4))
  • --table-footer-background: footer background (default transparent)
  • --table-footer-font-weight: footer font weight (default var(--font-weight-medium))
  • --table-header-background: header background (default transparent)
  • --table-header-color: header color (default var(--color-text-secondary))
  • --table-header-font-weight: header font weight (default var(--font-weight-medium))
  • --table-row-hover-background: row hover background (default light-dark(var(--alpha-02), var(--alpha-04)))