Skip to main content
Version: latest
Server Component

Table is best rendered on the server. Use the standard import (e.g. @prokodo/ui/table) — the library detects the runtime automatically.

Table

Table renders accessible tabular data with support for sortable columns, optional sticky header, zebra-striped rows, and a horizontal scroll wrapper for responsive layouts.

Live demo →

Overview

import { Table } from "@prokodo/ui/table"
;<Table
columns={[
{ key: "name", label: "Name", sortable: true },
{ key: "email", label: "Email" },
{ key: "role", label: "Role" },
]}
rows={users}
/>

Import

import { Table } from "@prokodo/ui/table"

CSS:

import "@prokodo/ui/table.css"

Props

PropTypeDefaultRequiredDescription
captionstringAccessible table caption.
ariaLabelstringARIA label for the table element.
headerTableHeaderCellProps[]Column header definitions.
bodyTableRowProps[]Table row data.
titlestringVisible title displayed above the table.
titlePropsHeadlinePropsProps forwarded to the title Headline.
contentstringOptional description below the title.
type"double" | "single""single""double" — all borders; "single" — row borders only.
containerClassNamestringCSS class on the table container wrapper.
classNamestringCSS class on root element.

See src/components/table/Table.model.ts for the full TableProps type.


Design Tokens

Customise via CSS custom properties on :root or a scoped ancestor element.

TokenDefaultDescription
--pk-table-border-colorvar(--pk-color-border)Row separator border colour
--pk-table-header-accent-colorvar(--pk-color-brand)First header cell accent colour
--pk-table-row-hover-bgcolor-mix(in srgb, var(--pk-color-brand) 8%, transparent)Row hover/focus background tint
--pk-table-caption-colorvar(--pk-color-muted)Caption text colour
--pk-table-cell-fgvar(--pk-color-fg)Default cell foreground colour
--pk-table-padding-yvar(--pk-space-xl)Cell vertical padding
--pk-table-padding-xvar(--pk-space-sm)Cell horizontal padding
--pk-table-container-pbvar(--pk-space-xl)Root container bottom padding

WCAG 2.2 Status

CriterionNameStatusNote
1.3.1Info and Relationships (A)✅ FulfilledSemantic structure (headings, lists, labels, landmarks) must be conveyed programmatically via HTML or ARIA.
1.3.2Meaningful Sequence (A)✅ FulfilledContent reading order in the DOM must match the intended visual presentation order.
1.4.3Contrast (Minimum) (AA)🔍 Manual reviewText must have a contrast ratio of at least 4.5:1 (3:1 for large text). Verify against the final product theme.
2.1.1Keyboard (A)🔍 Manual reviewAll functionality must be operable via keyboard alone, without requiring specific timing.
2.4.3Focus Order (A)🔍 Manual reviewThe keyboard focus sequence must preserve meaning and operability in the complete page integration context.
4.1.2Name, Role, Value (A)✅ FulfilledName, role, and state of all interactive UI components must be programmatically determinable via native HTML semantics or ARIA.

Test coverage: 2 jest-axe assertion(s) across 1 test file(s) · 1 ARIA attribute occurrence(s) in source scan. Criteria marked 🔍 require manual verification in the final product integration and theme context.

Storybook

👉 Open Table in Storybook


Source

src/components/table/Table.model.ts