Table <pm-table>
Basic table: columns and rows in, an accessible table out.
States
Each state is one attribute.
LoadingOverview
Sortable columns (natural, locale-aware), Intl formatting by column type, sticky header, striped/hover rows, loading skeleton, empty state, and labelled cards in narrow containers. About a third the size of <pm-data-table>; use that for search, filters, selection, paging, pinned/resizable columns, grouping and editing. For zero JS, style a plain <table class="pm-table">.
Cell content, first match wins: render(row) (text, DOM node or Lit template) → a light-DOM <template data-cell="key"> with {{field}} placeholders (values are escaped; also {{value}}, {{text}}) → format(value, row) → Intl formatting by type (number, currency, percent, bytes, date, datetime, time, boolean) with formatOptions, prefix/suffix → the plain value (arrays joined, objects as JSON). Headers: renderHeader(col) → <template data-header="key"> → label (always the accessible name). cellClass, headerClass and wrap style columns.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
columns | TableColumn<R>[] | [] | Column definitions: key, label, type, sorting, formatting and rendering. |
rows | R[] | [] | Row objects (or a JSON string). |
label | string | — | Accessible name (caption). |
sort | SortState | — | Current sort: { key, direction }. |
striped | boolean | false | Shade alternate rows. |
loading | boolean | false | Show a loading state (and mark the region busy for assistive tech). |
empty-textprop: emptyText | string | No results | Text shown when there is nothing to list. |
stack | 'auto' | 'never' | — | Narrow containers (< 36rem): auto shows rows as labelled cards; never keeps a scrolling table. |
max-heightprop: maxHeight | string | — | Scroll inside the table past this height (header stays visible), e.g. "24rem". |
locale | string | — | BCP 47 locale for number/date formatting (default: the page's). |
row-clickableprop: rowClickable | boolean | false | Rows are clickable and fire pm-row-click. |
manual | boolean | false | Rows are already sorted (server-side); just emit pm-sort. |
Also accepts the contextual attributes tone, surface, radius, density, motion, elevation. They are inherited from ancestors' data-* attributes.
Events
| Event | React / Svelte prop | Description |
|---|---|---|
pm-sort | onPmSort | The sort order changed. detail.direction is not set when the sort was removed. |
pm-row-click | onPmRowClick | A row was clicked (with row-clickable). |
Slots
| Slot | Description |
|---|---|
empty | Content when there are no rows. |