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/vue/components/Table";
import { DataTable, DataTableColumnHeader } from "@plexui/vue/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. Column definitions live in <script setup>: header and cell renderers are functions that return VNodes (h()), rendered with TanStack Table's FlexRender.

Variant

variant
emptyMessage
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

API

Table Primitives

PropTypeDefaultDescription
Tabletable—Root table container with horizontal scroll wrapper; attributes go to the <table>
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 with the default slot as content, merges class after its own, and forwards all other attributes and listeners (colspan, scope, @click, ...).

DataTable

PropTypeDefaultDescription
columnsColumnDef<TData>[]—Column definitions following TanStack Table v8 API; header and cell renderers return VNodes (required)
dataTData[]—Data array to display (required)
variant"default" | "bordered""default"Visual variant: bordered adds a rounded border and tinted header
page-sizenumber10Rows per page. Set 0 or Infinity to disable pagination. The rows-per-page select offers 10, 20, 50, 100 and this size
initial-sortingSortingState—Initial column sorting state
global-filterstring—Controlled search/filter string. Bind with v-model:global-filter
column-visibilityVisibilityState—Controlled column visibility state. Bind with v-model:column-visibility
enable-row-selectionbooleanfalseAdds 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
row-selectionRowSelectionState—Controlled row selection state. Bind with v-model:row-selection
get-row-id(row: TData) => string—Custom row ID accessor; selection keys use it
empty-messagestring | number | VNode"No results."Shown when no rows; the emptyMessage slot takes precedence
show-paginationbooleantrueWhether to show pagination controls. They hide on their own when every row fits on one page
classstring—Class applied to outermost wrapper
emptyMessage slotVNode[]—Rich content shown when no rows
@row-click(row: TData) => void—Click handler for rows. Makes rows interactive: they take Tab and call it on Enter or Space
@update:global-filter(value: string) => void—Emitted with the next filter when the table changes it; powers v-model:global-filter
@update:column-visibility(visibility: VisibilityState) => void—Emitted with the next visibility; powers v-model:column-visibility
@update:row-selection(selection: RowSelectionState) => void—Emitted with the next selection; powers v-model:row-selection

@row-click is a function prop rather than an event, because its presence makes the rows interactive; :on-row-click works the same. 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)
classstring—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 in the reader's time zone. It hydrates without a mismatch: the server writes the time in UTC (or in the timeZone of the options), and the reader's zone and wording follow once the page is in the browser. An ISO date or time written without a zone (2023-01-15, 2023-01-15T09:00) shows as written in every zone; a value that is no date shows as it is
statusCell(accessor, colorMap?)CellComponent—Badge cell with automatic status-to-color mapping
tooltipHeader(label, description)HeaderComponent—Header with dashed underline and info tooltip

Each helper returns a functional component for a column's cell or header; TanStack Table's FlexRender renders it with the cell or header context.

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)))