Table
vig-col columns, client-side or lazy sorting (one column or several), typed column filters and a global search, pagination, virtual scrolling, selection, cell editing, row reordering, column visibility, resizing, reordering and frozen columns, CSV export, persisted state, custom cells, expandable rows, sticky headers and loading and empty states.
vig-table vig-col [vigTableCell] [vigTableEmpty] [vigTableRowExpansion] [vigTableCellEditor] vig-table-column-toggle
import { Table, TableColumn, TableCell } from '@vigdx/ui/table';Basic
items and declare one vig-col per column; field names the property to show. Always give the table a caption — it names the table for screen readers.
| Invoice | Customer | Region | Amount |
|---|---|---|---|
| 1042 | Deniz Aksoy | Europe | 1250 |
| 1041 | Aylin Kaya | Europe | 89 |
| 1040 | Can Demir | Asia | 430 |
| 1039 | Mia Wong | Asia | 2210 |
| 1038 | Lucas Martin | Europe | 64.5 |
Sorting
sortable and two-way bind [(sort)] to read or preset the order. sortIndicator="active" shows only the sorted column's arrow.
| Deniz Aksoy | 2026-03-02 | 1250 |
| Aylin Kaya | 2026-03-01 | 89 |
| Can Demir | 2026-02-27 | 430 |
| Mia Wong | 2026-02-25 | 2210 |
| Lucas Martin | 2026-02-24 | 64.5 |
| Sofia Rossi | 2026-02-20 | 980 |
Sorted by date desc
Filtering
filter and the table adds a filter row: filter="text" (also number , date , boolean ) or a typed config such as { type: "select", options } . Bind [(filters)] to read or preset them; typed text and numbers apply after delay (300 ms) and the result count is announced politely. Date filters compare local calendar days; for date-only API values such as 2024-01-05T00:00:00Z , give the column a value accessor returning the local day. Objects in a select filter compare by identity unless the config sets compareWith .
| Customer | Status | Amount | Date |
|---|---|---|---|
| Deniz Aksoy | paid | 1250 | 2026-03-02 |
| Aylin Kaya | pending | 89 | 2026-03-01 |
| Can Demir | paid | 430 | 2026-02-27 |
| Mia Wong | failed | 2210 | 2026-02-25 |
| Lucas Martin | paid | 64.5 | 2026-02-24 |
| Sofia Rossi | paid | 980 | 2026-02-20 |
| Omar Haddad | pending | 150 | 2026-02-18 |
| Emma Johnson | paid | 3120 | 2026-02-15 |
| Kenji Sato | failed | 47 | 2026-02-11 |
| Ana Silva | paid | 615 | 2026-02-09 |
| Noah Smith | paid | 288 | 2026-02-04 |
| Zeynep Arslan | pending | 1999 | 2026-02-01 |
Filter menu
filterDisplay="menu" puts a filter button in each filterable header. Its menu offers the match mode, up to rules rules joined by "Match all" or "Match any", and Apply and Clear. An active filter shows a filled glyph and says so in the button name.
| Deniz Aksoy | 1250 | 2026-03-02 |
| Aylin Kaya | 89 | 2026-03-01 |
| Mia Wong | 2210 | 2026-02-25 |
| Lucas Martin | 64.5 | 2026-02-24 |
| Sofia Rossi | 980 | 2026-02-20 |
| Emma Johnson | 3120 | 2026-02-15 |
| Kenji Sato | 47 | 2026-02-11 |
| Ana Silva | 615 | 2026-02-09 |
| Zeynep Arslan | 1999 | 2026-02-01 |
Global search
[toolbar]="{ search: true }" renders a labelled search field bound to [(globalFilter)] , which searches every visible column (or globalFilterFields ). Matching is case- and accent-insensitive in the active locale, with Turkish dotted and dotless i handled. Values are searched as text: numbers as written, dates as their local day ( 2024-01-05 ); for what a cell template shows, use a value accessor.
| Customer | Region | Status |
|---|---|---|
| Deniz Aksoy | Europe | paid |
| Aylin Kaya | Europe | pending |
| Can Demir | Asia | paid |
| Mia Wong | Asia | failed |
| Lucas Martin | Europe | paid |
| Sofia Rossi | Europe | paid |
| Omar Haddad | Africa | pending |
| Emma Johnson | Americas | paid |
| Kenji Sato | Asia | failed |
| Ana Silva | Americas | paid |
| Noah Smith | Americas | paid |
| Zeynep Arslan | Europe | pending |
Search: ""
Computed columns
[value] accessor replaces row[field] for display, sorting, filtering, search and CSV — no string paths. field then only names the column.
| Deniz Aksoy | 1500 |
| Aylin Kaya | 106.8 |
| Can Demir | 516 |
| Mia Wong | 2652 |
| Lucas Martin | 77.4 |
| Sofia Rossi | 1176 |
Multi-column sort
sortMode="multiple" : Shift+click or Shift+Enter adds a column after the others — or, without modifiers, the "Add … to sort" button that appears when tabbing past a header — the headers show each priority and a third press removes a column. aria-sort stays on the first column and the status reads the whole order. [(sorts)] holds the order; sort mirrors its first entry, and writing sort sorts by that column alone.
| Africa | pending | 150 |
| Americas | paid | 3120 |
| Asia | failed | 2210 |
| Asia | paid | 430 |
| Europe | paid | 1250 |
| Europe | paid | 980 |
| Europe | pending | 89 |
| Europe | paid | 64.5 |
Shift+click a header to add it. Order: region asc, amount desc
Column visibility
[toolbar]="{ columns: true }" adds a Columns menu; hidden columns start hidden and [(columnVisibility)] holds the choice by column field (columns without one always show). The row header column always stays. A filter on a hidden column keeps applying, and the table then shows "Filters on hidden columns" with a Clear button. vig-table-column-toggle [table] places the same menu anywhere else.
| Customer | Amount | Status | Date |
|---|---|---|---|
| Deniz Aksoy | 1250 | paid | 2026-03-02 |
| Aylin Kaya | 89 | pending | 2026-03-01 |
| Can Demir | 430 | paid | 2026-02-27 |
| Mia Wong | 2210 | failed | 2026-02-25 |
| Lucas Martin | 64.5 | paid | 2026-02-24 |
Column resizing
resizableColumns adds a resize handle to each header with a field : drag it, or Tab to it (one more Tab stop per resizable header) and press ArrowLeft/ArrowRight (Shift for 50px steps, Home/End for the limits). The Columns menu, shown by default then, adds Narrower/Wider buttons per column and Reset widths: the way to resize without dragging. columnResizeMode="fit" (default) keeps the table width: the next resizable column of the same frozen group gives or takes the difference, else the flexible column — the last scrolling column, which has no handle and takes whatever width is left, so the layout follows the container and saved widths shrink to fit a narrower screen. expand grows the table, which then scrolls. minWidth / maxWidth (px, 48 and unlimited by default) bound a column and vig-col [resizable] opts single columns in or out. A drag shows live and is kept on release (keys once they pause): only then columnResized reports { field, width, widths } and state saves the widths, which it ignores while no column is resizable. From the first resize on, the table lays out at the set widths ( table-layout: fixed ) and cuts overflowing cell text.
| Customer | Region | Status | Amount |
|---|---|---|---|
| Deniz Aksoy | Europe | paid | 1250 |
| Aylin Kaya | Europe | pending | 89 |
| Can Demir | Asia | paid | 430 |
| Mia Wong | Asia | failed | 2210 |
Drag a header edge, or Tab to it and press the arrow keys.
Column reordering
reorderableColumns lets users drag a header (a long press on touch screens, so a swipe still scrolls) — and, as the keyboard and screen-reader way, the Columns menu gains "Move left" and "Move right" buttons per column (the menu shows by default then; [toolbar]="{ columns: false }" hides it when you place a vig-table-column-toggle elsewhere). Each move is announced ("Region moved to position 1 of 4"), columnReordered reports { field, from, to, order } and state keeps the order. Columns without a field stay in place; CSV export follows the order.
| Customer | Region | Status | Amount |
|---|---|---|---|
| Deniz Aksoy | Europe | paid | 1250 |
| Aylin Kaya | Europe | pending | 89 |
| Can Demir | Asia | paid | 430 |
| Mia Wong | Asia | failed | 2210 |
Frozen columns
frozen="start" or "end" on a vig-col keeps it in view while the table scrolls horizontally: logical, so RTL just works. Frozen columns render first (with the selection and expansion columns) or last, each sticky at the summed width of the ones before it — offsets follow resizing and hiding live — with a line on the boundary. They reorder only among themselves; a bare frozen attribute means start . Their cells are opaque — the row's hover, stripe and selection fill over --color-table-surface (the background by default: set it when the table sits on another surface) — and draw their own row line. They are marked data-frozen="start|end" for styling.
| Customer | Invoice | Region | Date | Status | Amount | |
|---|---|---|---|---|---|---|
| Deniz Aksoy | 1042 | Europe | 2026-03-02 | paid | 1250 | |
| Aylin Kaya | 1041 | Europe | 2026-03-01 | pending | 89 | |
| Can Demir | 1040 | Asia | 2026-02-27 | paid | 430 | |
| Mia Wong | 1039 | Asia | 2026-02-25 | failed | 2210 | |
| Lucas Martin | 1038 | Europe | 2026-02-24 | paid | 64.5 | |
| Sofia Rossi | 1037 | Europe | 2026-02-20 | paid | 980 | |
| Omar Haddad | 1036 | Africa | 2026-02-18 | pending | 150 | |
| Emma Johnson | 1035 | Americas | 2026-02-15 | paid | 3120 | |
| Kenji Sato | 1034 | Asia | 2026-02-11 | failed | 47 | |
| Ana Silva | 1033 | Americas | 2026-02-09 | paid | 615 | |
| Noah Smith | 1032 | Americas | 2026-02-04 | paid | 288 | |
| Zeynep Arslan | 1031 | Europe | 2026-02-01 | pending | 1999 |
Cell editing
editable (they need a field ) and the table becomes an APG editable grid: one Tab stop, arrow keys move between cells. Enter, F2, a double click or typing a character edits a cell; Enter commits and keeps focus on the cell (the APG grid behaviour, not a spreadsheet jump down, so a screen reader hears where it is), Tab and Shift+Tab commit and edit the next or previous editable cell, Escape cancels, and leaving the cell commits. Typing starts an edit with that character (AltGr and Option characters too); dead keys and IME input do not, so those users press Enter, F2 or double-click. Number cells get a number editor ( editType="number" also for cells that are empty yet, committing number | null ; unset, the value's type decides) that accepts digits of any script, a leading minus and only the locale's decimal separator: no grouping separators, so in a comma-decimal locale such as de 1.234 is rejected rather than guessed. [validate]="cellValidator((value: number | null, row: Payment) => …)" (a typed helper; (value, row) => string | null ) keeps an invalid value in the editor, aria-invalid and described by its error, which is announced; starting another edit meanwhile brings focus back to it instead of dropping what was typed. A vigTableCellEditor template replaces the input: [vigTableCellEditor]="statusOf" types let-value and let-row ; bind ariaLabel , call change(value) as the value changes (Enter, Tab and leaving commit it) or commit(value) for controls that finish on their own, and cancel() . The table never changes your rows: cellEdited reports { row, field, value, previousValue } and you replace the row in a new array. Give the table a rowId : it is how the table recognises the replaced row (without one it follows the row's position, with a dev-mode warning). An edit whose row leaves the screen (new data without it, a filter) or whose column is hidden or made read-only ends without committing. Saving to a server: update optimistically and put the old value back if the request fails. Editing works in tree tables (Enter or F2 on a cell), virtual tables (the edited row stays rendered), frozen columns and sorted tables (focus follows the row to its new place).
| Customer | Region | Status | Amount |
|---|---|---|---|
| Deniz Aksoy | Europe | paid | 1250 |
| Aylin Kaya | Europe | pending | 89 |
| Can Demir | Asia | paid | 430 |
| Mia Wong | Asia | failed | 2210 |
| Lucas Martin | Europe | paid | 64.5 |
Row reordering
reorderableRows adds a move handle to every row: drag it (a long press on touch screens), press Alt+ArrowUp or Alt+ArrowDown on it (Alt+Home and Alt+End to the ends), or click it for a menu with Move up, Move down, Move to top and Move to bottom, the way to move rows with a single pointer or a screen reader. In an editable grid the Alt keys work on any cell. Each move is announced ("Plan moved to position 3 of 5") and focus stays on the handle. rowReordered reports { row, from, to, items } with indexes in items and the new array: set items to it. Rows move in items order among the rows passing the filters (filtered-out rows keep their places; with the paginator the table follows a row to its page), so moving is off while the table is sorted or loading. A virtual table moves rows with the keys and the menu only (a dev-mode warning says dragging is off); tree tables do not move rows. With groupBy the keys and the menu move a row within its group (dragging is off there, and with row expansion). A move is announced once your new items show it; a move you do not apply is not announced.
| Move row | Customer | Region | Amount |
|---|---|---|---|
| Deniz Aksoy | Europe | 1250 | |
| Aylin Kaya | Europe | 89 | |
| Can Demir | Asia | 430 | |
| Mia Wong | Asia | 2210 | |
| Lucas Martin | Europe | 64.5 |
Last move: none yet
CSV export
exportCsv() downloads every row passing the filters, in the current order, from the visible columns, and returns the text. Options: filename , includeHidden , selectionOnly , separator , bom and sanitize , which by default neutralises spreadsheet formulas (OWASP CSV injection). toCsv(rows, columns) is the same serialiser as a pure function.
| Customer | Amount | Status |
|---|---|---|
| Deniz Aksoy | 1250 | paid |
| Aylin Kaya | 89 | pending |
| Can Demir | 430 | paid |
| Mia Wong | 2210 | failed |
Persisted state
state="orders" keeps sort, filters, page, page size, column visibility, column widths and order, and expanded rows in localStorage; { key, storage, exclude, migrate } picks session , url or a custom TableStateStorage , leaves parts out (e.g. exclude: ['globalFilter'] ) and converts older payloads. Web Storage keys are namespaced vig-table:<key> ; dates are saved as calendar days and object filter values are not saved. Privacy: with url storage, filter text lands in the address bar, history, server logs and Referer headers. Restored filters, sorts and match modes are validated against the columns. The state is restored in the browser right after the first render, so server-rendered pages hydrate without a mismatch (the restored view shows one frame later).
| Status | ||
|---|---|---|
| Deniz Aksoy | 1250 | paid |
| Aylin Kaya | 89 | pending |
| Can Demir | 430 | paid |
| Mia Wong | 2210 | failed |
Server-side data
lazyState() into resource() . It carries paging, sort, sorts , filters and globalFilter — the same shape the client mode uses — and only changes when one of them does.
| Deniz Aksoy | 1250 | Europe |
| Aylin Kaya | 89 | Europe |
| Can Demir | 430 | Asia |
| Mia Wong | 2210 | Asia |
Gridlines, stripes and paginator placement
gridlines adds column lines, striped alternate fills; paginatorOptions places the paginator at the start , the end (default) or both , and adds a jump-to-page field.
| Invoice | Customer | Amount |
|---|---|---|
| 1042 | Deniz Aksoy | 1250 |
| 1041 | Aylin Kaya | 89 |
| 1040 | Can Demir | 430 |
| 1039 | Mia Wong | 2210 |
Selection
selectionMode="multiple" adds a checkbox column with select-all; bind [(selection)] and give rowId so selections survive new row objects. Mark the naming column rowHeader so each checkbox reads "Select row" plus that row's name.
| Customer | Status | Amount | |
|---|---|---|---|
| Deniz Aksoy | paid | 1250 | |
| Aylin Kaya | pending | 89 | |
| Can Demir | paid | 430 | |
| Mia Wong | failed | 2210 | |
| Lucas Martin | paid | 64.5 |
0 of 5 selected
Pagination
paginator slices the rows client-side; rows and rowsPerPageOptions set the page size. For server data set lazy with totalRecords and load on lazyLoad .
| 1042 | Deniz Aksoy | 1250 |
| 1041 | Aylin Kaya | 89 |
| 1040 | Can Demir | 430 |
| 1039 | Mia Wong | 2210 |
| 1038 | Lucas Martin | 64.5 |
Custom cells
ng-template vigTableCell inside a column renders any content; let-row is the row, let-i="rowIndex" its index. Import TableCell , or the template is silently ignored.
| Customer | Status | Amount | Actions |
|---|---|---|---|
| €1,250.00 | |||
| €89.00 | |||
| €430.00 | |||
| €2,210.00 | |||
| €64.50 |
Row expansion
vigTableRowExpansion template adds a labelled toggle per row and renders under expanded rows. Bind [(expandedRows)] and narrow with rowExpandable . For rows that expand into child rows, see the tree table: rowChildren .
| Expand row | Customer | Status | Amount |
|---|---|---|---|
| Deniz Aksoy | paid | 1250 | |
Invoice #1042 for Deniz Aksoy (Europe), settled on 2026-03-02. | |||
| Aylin Kaya | pending | 89 | |
| Can Demir | paid | 430 | |
| Mia Wong | failed | 2210 | |
| Lucas Martin | paid | 64.5 | |
Sticky header and scrolling
stickyHeader with a scrollHeight keeps the header in view while the body scrolls; the scroll region (also a too-wide table) is keyboard reachable and named by the caption.
| Invoice | Customer | Date | Amount |
|---|---|---|---|
| 1042 | Deniz Aksoy | 2026-03-02 | 1250 |
| 1041 | Aylin Kaya | 2026-03-01 | 89 |
| 1040 | Can Demir | 2026-02-27 | 430 |
| 1039 | Mia Wong | 2026-02-25 | 2210 |
| 1038 | Lucas Martin | 2026-02-24 | 64.5 |
| 1037 | Sofia Rossi | 2026-02-20 | 980 |
| 1036 | Omar Haddad | 2026-02-18 | 150 |
| 1035 | Emma Johnson | 2026-02-15 | 3120 |
| 1034 | Kenji Sato | 2026-02-11 | 47 |
| 1033 | Ana Silva | 2026-02-09 | 615 |
| 1032 | Noah Smith | 2026-02-04 | 288 |
| 1031 | Zeynep Arslan | 2026-02-01 | 1999 |
Virtual scrolling
virtualScroll renders only the rows in view (and a few around them), here 100,000. virtualScroll="auto" gives the table the same layout at any size but windows the rows only from 200 ( TABLE_VIRTUAL_THRESHOLD ), and again renders them all below 150, so crossing the threshold changes no layout. Every row has one height, the median pitch of rendered rows, measured again when the font, density or pointer changes (deep in the table, the row at the top stays in place). Cells, group headers and error rows therefore stay on one line: long text ends in an ellipsis, plain cells show it in full as a title, and screen readers read it whole. The table uses table-layout: fixed , so column widths come from the header and do not jump while rows come and go: give columns a sufficient width ; the others share the rest, each at least --vig-table-column-min-width (8rem), below which the table scrolls sideways. The header is sticky and the body scrolls within the --vig-table-height token (24rem; scrollHeight wins). The focused row stays rendered wherever the view goes. Sorting, filtering and paging go back to the first row; scrollToIndex(i) and scrollToRow(row) jump to a row without moving focus. Selection, select-all and groupBy work on every row; with the paginator it renders the page's rows. Tables with a vigTableRowExpansion template (rows of differing height) render every row, with a dev-mode warning.
| Customer | Region | |||
|---|---|---|---|---|
| 1 | Deniz Aksoy | Europe | 0 | |
| 2 | Aylin Kaya | Europe | 2919 | |
| 3 | Can Demir | Asia | 838 | |
| 4 | Mia Wong | Asia | 3757 | |
| 5 | Lucas Martin | Europe | 1676 | |
| 6 | Sofia Rossi | Europe | 4595 | |
| 7 | Omar Haddad | Africa | 2514 | |
| 8 | Emma Johnson | Americas | 433 | |
| 9 | Kenji Sato | Asia | 3352 | |
| 10 | Ana Silva | Americas | 1271 | |
| 11 | Noah Smith | Americas | 4190 | |
| 12 | Zeynep Arslan | Europe | 2109 | |
| 13 | Deniz Aksoy | Europe | 28 | |
| 14 | Aylin Kaya | Europe | 2947 | |
| 15 | Can Demir | Asia | 866 | |
| 16 | Mia Wong | Asia | 3785 | |
| 17 | Lucas Martin | Europe | 1704 | |
| 18 | Sofia Rossi | Europe | 4623 | |
| 19 | Omar Haddad | Africa | 2542 | |
| 20 | Emma Johnson | Americas | 461 | |
| 21 | Kenji Sato | Asia | 3380 | |
| 22 | Ana Silva | Americas | 1299 | |
| 23 | Noah Smith | Americas | 4218 | |
| 24 | Zeynep Arslan | Europe | 2137 | |
| 25 | Deniz Aksoy | Europe | 56 | |
| 26 | Aylin Kaya | Europe | 2975 | |
| 27 | Can Demir | Asia | 894 | |
| 28 | Mia Wong | Asia | 3813 | |
| 29 | Lucas Martin | Europe | 1732 | |
| 30 | Sofia Rossi | Europe | 4651 | |
| 31 | Omar Haddad | Africa | 2570 | |
| 32 | Emma Johnson | Americas | 489 | |
| 33 | Kenji Sato | Asia | 3408 | |
| 34 | Ana Silva | Americas | 1327 | |
| 35 | Noah Smith | Americas | 4246 | |
| 36 | Zeynep Arslan | Europe | 2165 | |
| 37 | Deniz Aksoy | Europe | 84 | |
| 38 | Aylin Kaya | Europe | 3003 | |
| 39 | Can Demir | Asia | 922 | |
| 40 | Mia Wong | Asia | 3841 |
Empty state
emptyMessage , or a vigTableEmpty template such as an empty state with a next step.
| Customer | Amount |
|---|---|
No payments yetPayments you record will be listed here. | |
Server-side data recipe
The table's whole view state is one typed signal. Hand it to resource() (or httpResource()) and render what comes back:
protected readonly table = viewChild(Table<Order>);
protected readonly page = resource({
// first, rows, sort, sorts, filters, globalFilter
params: () => this.table()?.lazyState(),
loader: ({ params, abortSignal }) =>
fetch(`/api/orders?state=${encodeURIComponent(JSON.stringify(params))}`, {
signal: abortSignal,
}).then((response) => response.json() as Promise<{ rows: Order[]; total: number }>),
});
// <vig-table [lazy]="true" [items]="page.value()?.rows ?? []"
// [totalRecords]="page.value()?.total" [loading]="page.isLoading()" …> With state set, the table restores the saved view right after the first render; until then stateReady() is false. Gate the request on it to skip loading the defaults first: params: () => (table.stateReady() ? table.lazyState() : undefined). The lazyLoad output already waits.
Texts and performance
- Every new text (filter menu, toolbar, result and multi-sort announcements) is a key of the typed
labelsinput, merged over the locale defaults ofprovideVigdxUi(English and Turkish built in). Visible texts end in…Label, screen-reader-only ones in…AriaLabel, status messages in…Announcementand placeholders in…Placeholder. These keys are optional onVigdxLabels, so a complete labels object written for an earlier version keeps compiling. - Client mode filters and sorts in memory with
FilterMatcher(also injectable on its own, withregister(name, fn)for custom match modes). With 10,000 rows a filter or sort change, including rendering a 25-row page, takes about 50–80 ms in jsdom on a dev machine; uselazywith a server for larger sets. - Rendering is what grows with the rows on screen: without a paginator, turn on
virtualScroll(or"auto") and the table renders a window of about two screens of rows whatever the data size; scrolling re-renders a few rows at a time. Browsers cap the height of an element — Firefox at about 17.9 million px, Chromium and WebKit at about 33.5 million — so one virtual table holds up to about 400,000 rows of the default height; a dev-mode warning comes from 15 million px. Page or load larger sets from a server.
Styling hooks
Internal elements carry a stable data-part and the component's data-scope; both are public API, so removing one is a breaking change. Select a part by both, e.g. [data-scope="table"][data-part="toolbar"] { … }: the pair stays within this component when kit components nest, and also reaches parts in overlay panels, which render outside the host. State is exposed through aria-* and, where listed, a data-state; literal values are checked by the API gate, values computed from the component's state follow its documented types. Other data-* attributes listed below (such as data-opening while an overlay animates) are API too. See Customizing.
Table [data-scope="table"]
| Part | Element | data-state |
|---|---|---|
toolbar | — | |
search | — | |
filter-indicator | — | |
frame | — | |
loading | — | |
scroll | — | |
table | <table> . | — |
head | <thead> . | — |
header-cell | <th> ( aria-sort ; data-frozen="start|end" when frozen, like every frozen cell). | — |
resize-handle | role="separator" , resizableColumns ). | dragging |
sort | — | |
sort-priority | — | |
sort-priority-label | — | |
add-to-sort | — | |
filter-row | filterDisplay="row" ). | — |
filter-trigger | filterDisplay="menu" ). | — |
filter-panel | — | |
clear-selection | — | |
body | <tbody> . | — |
spacer | virtualScroll ): the aria-hidden row standing in for the rows above or below the rendered ones. | — |
group-header | groupBy ). | — |
row | selected | |
row-handle | reorderableRows ): drag it, Alt+ArrowUp/ArrowDown on it, or click it for its move menu. | — |
select | — | |
select-all | — | |
expand | — | |
cell | <td> or row-header <th> ( data-frozen="start|end" when frozen). | editing |
editor | editable column). | — |
editor-error | aria-describedby of the editor). | — |
expansion | — | |
toggle | rowChildren ; aria-expanded , no Tab stop of its own). | open, closed |
children-loading | — | |
children-error | — | |
retry | — | |
empty | — | |
paginator | vig-paginator (top and bottom). | — |
TableColumnToggle [data-scope="table"]
| Part | Element | data-state |
|---|---|---|
column-toggle | — | |
column-move-left | reorderableColumns ). | — |
column-move-right | reorderableColumns ). | — |
column-narrow | — | |
column-widen | — | |
column-reset-widths | — |
Accessibility
- Renders a native
<table>with<th scope="col">headers;captionbecomes a visually hidden<caption>. Mark the column that names each row with<vig-col rowHeader>to render its cells as<th scope="row">. - Sortable headers are buttons inside the header cell, and the sorted column carries
aria-sort. Each sort is announced through one polite status ("Sorted by Name, ascending";sortAscendingAnnouncement,sortDescendingAnnouncement). - Selection is a native control per row: radios for
selectionMode="single"(one group, so the arrow keys move the selection) and checkboxes formultiple, labelled per row (selectRowAriaLabel) and for the whole page (selectAllAriaLabel); a row click is only a pointer shortcut. Like any radio, a single-selection radio only selects; a translatable "Clear selection" button (clearSelectionAriaLabel) in its column header clears it. The controls belong to no form (form=""), so they never submit or post a surrounding form. Expansion toggles exposearia-expandedandaria-controls. With a row header column, the row controls add the row's header to their name ("Select row Alice"). - Whenever the table can scroll — a capped height or columns wider than the container — its scroll area becomes a focusable
role="region"named by the caption (orscrollRegionAriaLabel), so keyboard users can scroll it. - A virtual table keeps its table semantics: the table carries
aria-rowcount(every row, the header rows included) and each rendered row itsaria-rowindex, so screen readers announce "row 5,002 of 100,001". The spacer rows around the window arearia-hidden; with the paginator, positions count every page. Tab moves through the rendered rows' controls and the area scrolls to follow; the row holding focus stays rendered at its own place while the window moves (a scroll, a jump, a sort), so focus never falls back to the page. A sticky header sets the region'sscroll-padding-top, which keeps focused rows clear of it. - A flat virtual table has no row-to-row keyboard model (a tree table has one): a screen reader's table or browse navigation stops at the edge of the rendered rows until the region scrolls. For screen-reader-heavy screens prefer the paginator, which puts every row of a page in the DOM.
- A resize handle is an APG window splitter:
role="separator"witharia-orientation="vertical", a value in pixels (aria-valuenow/min/max, spoken as "120 pixels",labels.columnWidthAriaLabel) and a name ("Resize Name column",labels.resizeColumnAriaLabel). It adds one Tab stop per resizable header; ArrowLeft and ArrowRight (mirrored in RTL) resize by 10px, with Shift by 50px, Home and End jump to the limits. Its hit area is 24px wide (44px on coarse pointers). The header is named by its content througharia-labelledby, so cells never read the handle's name. Pointer drags capture the pointer; only the handle setstouch-action: none. Dragging is never the only way: the Columns menu's Narrower, Wider and Reset widths buttons (labels.narrowColumnAriaLabel,widenColumnAriaLabel,resetColumnWidthsLabel) work with a single pointer (WCAG 2.5.7), and their changes are announced (columnResizedAnnouncement,columnWidthsResetAnnouncement). - Column reordering has a keyboard and screen-reader path besides dragging: the Move left and Move right buttons of the Columns menu (
labels.moveColumnLeftAriaLabel,moveColumnRightAriaLabel). Focus stays on the button that moved the column, and every move is announced through the table's polite status (labels.columnMovedAnnouncement). - A flat table with
editablecolumns is an APG editable grid (role="grid", named by the caption): one Tab stop on a cell (a rovingtabindex), arrow keys between cells (mirrored in RTL), Home/End, Ctrl+Home/End and PageUp/PageDown; keys with no cell in their direction are left to the browser. The row's own controls (selection, expansion, move handle) and the controls of cell templates are no Tab stops of their own there, so the grid is one Tab stop: Enter or Space on a row control's cell presses it, Enter or F2 moves into a cell template's controls, Escape back. Cells the grid does not edit carryaria-readonly. Detail rows (vigTableRowExpansion) are no grid rows: the arrow keys pass them by, and their controls keep their own Tab stops. Cells draw an outline focus ring, kept in forced colors. In a tree table, cells keep the treegrid's keys and Enter or F2 edits. - The default editor is a native input named "Edit Name, row 3" (
labels.editCellAriaLabel), at least 16px on touch screens so iOS does not zoom. An invalid value setsaria-invalidandaria-describedbyon it and announces the error; commits ("Name changed",labels.cellEditedAnnouncement) and cancels (labels.editCancelledAnnouncement) are announced through the table's polite status. Focus returns to the cell on Enter, Escape and a custom editor'scommit, and stays on the edited row's cell when the edit moves it in the sort order. - Each row's move handle is a button named "Move row" plus the row header ("Move row Alice",
labels.moveRowAriaLabel) witharia-haspopup="menu"andaria-keyshortcuts; its hit area is 24px (44px on coarse pointers) and only it setstouch-action: none. Its menu (labels.moveRowUpLabel,moveRowDownLabel,moveRowTopLabel,moveRowBottomLabel) is the single-pointer alternative to dragging (WCAG 2.5.7); in a grid, closing it returns focus to the handle's cell. A move is announced once the rows show it, half a second later (labels.rowMovedAnnouncement), after the moved handle got its focus back, so the announcement is not lost. The CDK drag machinery exists only while rows can be dragged, joins no surroundingcdkDropListGroupand lets no other item in. - Frozen cells never rely on color: their boundary is a border (kept in forced colors), and their opaque fills come from tokens. The scroll area is an isolated stacking context (
isolation: isolate): frozen cells atz-index: 1and the sticky header at 10 stack inside it (the loading cover at 20 above it), never against the page's own sticky bars, and overlays use the top layer. A dragged header's placeholder is outlined as well as faded, for forced colors. Header dragging creates its CDK drag machinery only whilereorderableColumnsis on (no document touch listener otherwise) and joins no surroundingcdkDropListGroup. - Filter editors are labelled ("Filter Customer") and live in a data row of the header, so they never become headers of the body cells. The filter menu is a named non-modal dialog: focus moves into it, Escape and Apply return focus to its button, and the button names an active filter ("Filter Amount (filtered)") besides showing a filled glyph — never color alone. Filtered result counts are announced once, debounced, through the table's single polite status.
- Multi-sort keeps
aria-sorton the first sorted column only; the others carry a visually hidden priority ("sort priority 2"), and the status reads the whole order. - While
loading, the table isaria-busyand shows avig-spinnernamedloadingAriaLabel. Every built-in label is an input for i18n.
API
Table
vig-tableData table for the backoffice list screens: client-side or lazy
(server-side) sorting — by one column or several (sortMode="multiple") —
column filters (columns with a filter, as a filter row or filter menus) and
a global filter, pagination, checkbox or radio selection (a row click
selects too), group subheaders, expandable rows, column visibility, CSV
export, persisted state (state), loading and empty states.
With rowChildren (or loadChildren) it becomes a tree table: the
items are the root rows and the table an APG treegrid. virtualScroll
renders only the rows in view, for tens of thousands of rows.
Columns can be resized (resizableColumns), reordered
(reorderableColumns) and frozen (vig-col frozen), also in a virtual
table. Cells of editable columns are edited in place (cellEdited), and
reorderableRows lets users move rows (rowReordered); the table never
changes your items itself.
resize-handle dragging
| Name | Type | Default | Description |
|---|---|---|---|
caption | string | undefined | undefined | Accessible table name, rendered as a visually hidden caption. |
cascade | boolean | true | Tree table with |
clearSelectionAriaLabel | string | undefined | undefined | Name of the single-selection column's clear button (i18n). |
collapseRowAriaLabel | string | undefined | undefined | — |
columnResizeMode | TableColumnResizeMode | 'fit' |
|
columnVisibility | Readonly<Record<string, boolean>> | — | Visibility per column |
emptyMessage | string | undefined | undefined | — |
expandedRows | T[] | [] | Expanded rows of a table with a |
expandRowAriaLabel | string | undefined | undefined | — |
filterDisplay | TableFilterDisplay | 'row' |
|
filters | TableFilters | — | Column filters by column |
first | number | 0 | — |
globalFilter | string | '' | Text searched ( |
globalFilterFields | readonly string[] | undefined | undefined | Column fields the global filter searches; every visible column with a |
gridlines | boolean | false | Lines between columns as well as rows. |
groupBy | string | undefined | undefined | Inserts a subheader row whenever this property's value changes. |
items | readonly T[] | [] | — |
labels | Partial<TableLabels> | — | Texts of the filter UI, multi-sort, toolbar and result status (i18n); locale defaults. |
lazy | boolean | false | Rows are already paged/sorted by the server; state changes emit lazyLoad. |
loadChildren | TableChildrenLoader<T> | undefined | undefined | Fetches the children of rows whose |
loading | boolean | false | — |
loadingAriaLabel | string | undefined | undefined | — |
paginator | boolean | false | Renders the embedded paginator and (non-lazy) slices the rows. |
paginatorLabels | PaginatorLabels | — | — |
paginatorOptions | TablePaginatorOptions | — | Paginator placement ( |
paginatorReportPosition | PaginatorReportPosition | 'start' | — |
paginatorSize | PaginatorSize | 'sm' | — |
reorderableColumns | boolean | false | Lets users reorder the columns with a |
reorderableRows | boolean | false | Lets users move rows: drag a row by its handle (a long press on touch
screens), press Alt+ArrowUp/ArrowDown (Alt+Home/End) on the handle or a
cell, or pick a move from the handle's menu. Moves are announced and
reported as |
resizableColumns | boolean | false | Adds a resize handle to the header of every column with a |
rowChildren | TableChildrenAccessor<T> | undefined | undefined | Makes the table a tree table: the children of a row, e.g.
The table then is an APG treegrid: a toggle in the row-header column
(else the first column) expands rows ( |
rowExpandable | ((row: T) => boolean) | undefined | undefined | Which rows get an expansion toggle; every row when unset. |
rowHover | boolean | false | Pointer feedback (hover fill + cursor) for rowClick-driven tables. |
rowId | ((row: T) => unknown) | undefined | undefined | Row identity for selection and tracking, e.g. |
rows | number | 10 | — |
rowSelectable | ((row: T) => boolean) | undefined | undefined | Which rows can be selected; every row when unset. The others show a disabled checkbox or radio with their own state, and a row click or the header checkbox leaves them as they are. |
rowsPerPageOptions | readonly number[] | [] | — |
scrollHeight | string | undefined | undefined | Max height of the scrolling body area, any CSS length, e.g. |
scrollRegionAriaLabel | string | undefined | undefined | Name of the scroll region when there is no |
selectAllAriaLabel | string | undefined | undefined | — |
selection | T[] | [] | Selected rows; holds at most one entry in single mode. |
selectionMode | "none" | "single" | "multiple" | 'none' |
|
selectRowAriaLabel | string | undefined | undefined | — |
size | TableSize | 'md' | Row density: vertical cell padding of the body rows. |
sort | TableSort | null | null | The sorted column; in |
sortAscendingAnnouncement | string | undefined | undefined | Status announced after an ascending sort; |
sortDescendingAnnouncement | string | undefined | undefined | Status announced after a descending sort; |
sortIndicator | TableSortIndicator | 'always' |
|
sortMode | "single" | "multiple" | 'single' |
|
sorts | TableSort[] | [] | Every sorted column in priority order: the source of truth in
|
state | TableStateOptions | undefined | undefined | Keeps sort, filters, page, page size, column visibility and expanded rows
across visits: a storage key ( |
stickyHeader | boolean | false | Keeps the header row in view while the body scrolls (set |
striped | boolean | false | Alternating row fills. |
toolbar | TableToolbar | — | Built-in controls above the table: |
totalRecords | number | undefined | undefined | Total row count on the server (lazy mode). |
virtualScroll | TableVirtualScroll | false | Renders only the body rows in view (and a few around them), for large
flat or tree tables: |
| Name | Payload | Description |
|---|---|---|
cellEdited | TableCellEditEvent<T> | A committed cell edit of an |
columnReordered | TableColumnReorderEvent | A column the user moved, by dragging its header or from the column menu. |
columnResized | TableColumnResizeEvent | A column the user resized (pointer drag released, or a key press on its handle). |
columnVisibilityChange | Readonly<Record<string, boolean>> | Visibility per column |
expandedRowsChange | T[] | Expanded rows of a table with a |
filtersChange | TableFilters | Column filters by column |
firstChange | number | — |
globalFilterChange | string | Text searched ( |
lazyLoad | TableLazyLoadEvent | — |
rowClick | T | Fired on any row click (all selection modes) — e.g. navigate to detail. Pointer shortcut only; give keyboard users an explicit control in a cell. |
rowReordered | TableRowReorderEvent<T> | A row the user moved ( |
rowsChange | number | — |
selectionChange | T[] | Selected rows; holds at most one entry in single mode. |
sortChange | TableSort | null | The sorted column; in |
sortsChange | TableSort[] | Every sorted column in priority order: the source of truth in
|
| Signature | Description |
|---|---|
clearFilters(): void | Clears every column filter and the global filter, including values still being typed. |
exportCsv(options: TableCsvExportOptions = {}): string | Exports the rows as CSV and, in the browser, downloads the file. By
default: the visible columns with a |
isColumnVisible(column: TableColumn): boolean | Whether the column shows: its |
isExpanded(row: T): boolean | — |
isSelected(row: T): boolean | Whether the row is selected; with a cascading tree selection, whether it shows checked. |
reloadChildren(row?: T): void | Forgets what |
scrollToIndex(index: number): void | Scrolls the display row at |
scrollToRow(row: T): boolean | Scrolls |
setColumnVisible(column: TableColumn, visible: boolean): void | Shows or hides a column (writes |
trackRow(row: T): unknown | — |
TableColumn
vig-colDeclares one table column. Renders nothing itself — vig-table reads the inputs and the optional cell template:
Example :<vig-col field="name" header="Name" [sortable]="true" />
<vig-col header="Actions">
<ng-template vigTableCell let-row let-i="rowIndex">…</ng-template>
</vig-col>| Name | Type | Default | Description |
|---|---|---|---|
align | "start" | "center" | "end" | "left" | "right" | 'left' | Text alignment of the column's cells and header. |
editable | boolean | false | Lets users edit the column's cells (needs a |
editType | TableCellEditType | undefined | undefined | The default editor of an |
field | string | undefined | undefined | Property read from the row for display and client-side sorting. |
filter | TableColumnFilterConfig | undefined | undefined | Makes the column filterable (needs a |
frozen | TableColumnFrozen | undefined | undefined | Keeps the column in view while the table scrolls horizontally, pinned to
the inline |
header | string | '' | — |
hidden | boolean | false | Starts the column hidden; the column menu or |
maxWidth | number | undefined | undefined | Widest width a resize gives the column, in px; unlimited by default. |
minWidth | number | undefined | undefined | Narrowest width a resize leaves the column, in px; 48 by default. |
resizable | boolean | undefined | undefined | Gives the column a resize handle ( |
rowHeader | boolean | false | Renders this column's cells as row headers ( |
sortable | boolean | false | — |
validate | TableCellValidator | undefined | undefined | Checks an edited value before it is committed: an error message keeps
the editor open showing it, |
value | TableValueAccessor | undefined | undefined | Typed accessor of the cell value, e.g. |
width | string | undefined | undefined | Any CSS width, e.g. '12rem' or '20%'. |
TableCellEditor
ng-template[vigTableCellEditor]Marks an ng-template inside an editable vig-col as its cell editor,
replacing the default text (or number) input. Bind the context's
ariaLabel (and, while invalid, errorId and error) to the control;
call change as the value changes, or commit for controls that finish
on their own (a select). Enter, Tab and leaving the cell commit what
change recorded; Escape cancels. A control that uses Enter or Escape
itself (a list it opens) calls preventDefault() on them.
Bind an accessor, e.g. [vigTableCellEditor]="statusOf", to type
let-value and let-row; it also reads the value the editor starts from
(the column's value accessor or field by default).
<vig-col field="status" header="Status" editable>
<ng-template [vigTableCellEditor]="statusOf" let-value let-commit="commit" let-label="ariaLabel">
<select [attr.aria-label]="label" (change)="commit($any($event.target).value)">…</select>
</ng-template>
</vig-col>| Name | Type | Default | Description |
|---|---|---|---|
vigTableCellEditor | ((row: T) => V) | '' | undefined | undefined | Reads the value the editor starts from; types the template context. |
TableColumnToggle
vig-table-column-toggleA "Columns" button whose popover lists the columns of a vig-table with a
checkbox each, to show or hide them. vig-table renders one itself with
[toolbar]="{ columns: true }"; place this component anywhere else (a page toolbar) and
hand it the table:
<vig-table-column-toggle [table]="orders" />
<vig-table #orders …>…</vig-table>Columns are keyed by field: columns without one, and the row header
column (rowHeader), which names the rows and their controls, are not
listed; the last visible column cannot be hidden. With
reorderableColumns on the table, the menu lists the columns in their
order and adds "Move left" and "Move right" buttons to each; with
resizable columns, "Narrower" and "Wider" buttons to those and a "Reset
widths" button (the row header column is listed then too; it still
cannot be hidden). They are the way to reorder and resize without
dragging: keyboards, screen readers and single pointers (WCAG 2.5.7).
| Name | Type | Default | Description |
|---|---|---|---|
label | string | undefined | undefined | Button label and menu name; |
table | TableColumnToggleHost | — | The table whose columns the menu lists. |
FilterMatcher
Locale-aware, typed row filtering for vig-table and anything else that filters records. Pure apart from the registry: matching never mutates the rows, and the same rows, filters and locale give the same result.
Text modes compare case- and accent-insensitively (Intl.Collator,
sensitivity: 'base', for equality; locale-folded text for substrings),
so in Turkish istanbul finds İstanbul but not Istanbul, whose lower
case is ıstanbul. Number and date modes compare numerically; date modes
compare the local calendar day. Add modes with register:
inject(FilterMatcher).register('even', (value) => Number(value) % 2 === 0);| Signature | Description |
|---|---|
filter(rows: readonly T[], filters: TableFilters, options: FilterRowsOptions<T> = {},): readonly T[] | The rows that pass every column filter (keyed by field) and, when set,
the global filter ( |
has(mode: string): boolean | Whether |
match(matchMode: FilterMatchMode, value: unknown, filter: unknown, locale?: string): boolean | Whether |
register(name: string, fn: FilterMatchFn): void | Adds a match mode, or replaces one with the same name. |
Templates and directives
| Selector | Export | Description |
|---|---|---|
[vigTableCell] | TableCell | Marks an ng-template as a column's custom cell. The explicit marker keeps
the query away from the TemplateRefs Angular creates for control-flow
blocks (@if/@for) around the template. Like every directive, it only
applies when the consuming component imports |
[vigTableEmpty] | TableEmpty | Marks an ng-template as the empty-state content of vig-table. |
ng-template[vigTableRowExpansion] | TableRowExpansion | Marks an ng-template as the detail content of expandable rows. When present, vig-table adds a leading toggle column and renders the template in a full-width row under every expanded row: Example : |
[vigTableGroupHeader] | TableGroupHeader | Marks an ng-template as the group subheader; context: group value + first row. |