# Table

A data table for list screens: declarative `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.

- Package: [@vigdx/ui](https://www.npmjs.com/package/@vigdx/ui)
- Selectors: `vig-table`, `vig-col`, `[vigTableCell]`, `[vigTableEmpty]`, `[vigTableRowExpansion]`, `[vigTableCellEditor]`, `vig-table-column-toggle`
- Source: [libs/ui/src/lib/molecules/table/table.ts](https://github.com/bakyurekk/vigdx/blob/main/libs/ui/src/lib/molecules/table/table.ts)

```typescript title="Import"
import { Table, TableColumn, TableCell } from '@vigdx/ui/table';
```

## Basic

Pass rows as `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.

```typescript title="table-basic.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-basic',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Recent payments" [items]="payments">
      <vig-col field="id" header="Invoice" width="6rem" />
      <vig-col field="customer" header="Customer" />
      <vig-col field="region" header="Region" />
      <vig-col field="amount" header="Amount" align="end" />
    </vig-table>
  `,
})
export class TableBasicDemo {
  protected readonly payments = PAYMENTS.slice(0, 5);
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Sorting

Mark columns `sortable` and two-way bind `[(sort)]` to read or preset the order. `sortIndicator="active"` shows only the sorted column's arrow.

```typescript title="table-sorting.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn, type TableSort } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-sorting',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments" [(sort)]="sort" sortIndicator="active">
      <vig-col field="customer" header="Customer" [sortable]="true" />
      <vig-col field="date" header="Date" [sortable]="true" />
      <vig-col field="amount" header="Amount" align="end" [sortable]="true" />
    </vig-table>
    <p class="text-sm text-muted-foreground">
      Sorted by {{ sort()?.field ?? 'nothing' }} {{ sort()?.direction ?? '' }}
    </p>
  `,
})
export class TableSortingDemo {
  protected readonly payments = PAYMENTS.slice(0, 6);
  protected readonly sort = signal<TableSort | null>({ field: 'date', direction: 'desc' });
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Filtering

Give a column a `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`.

```typescript title="table-filtering.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { type TableFilters } from '@vigdx/ui/core';
import { Table, TableColumn, type TableColumnFilterConfig } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-filtering',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments" [(filters)]="filters" size="sm">
      <vig-col field="customer" header="Customer" filter="text" />
      <vig-col field="status" header="Status" [filter]="status" />
      <vig-col field="amount" header="Amount" align="end" filter="number" />
      <vig-col field="date" header="Date" filter="date" />
    </vig-table>
  `,
})
export class TableFilteringDemo {
  protected readonly payments = PAYMENTS;
  protected readonly filters = signal<TableFilters>({});
  protected readonly status: TableColumnFilterConfig = {
    type: 'select',
    options: [
      { value: 'paid', label: 'Paid' },
      { value: 'pending', label: 'Pending' },
      { value: 'failed', label: 'Failed' },
    ],
  };
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '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.

```typescript title="table-filter-menu.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { type TableFilters } from '@vigdx/ui/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-filter-menu',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments" filterDisplay="menu" [(filters)]="filters">
      <vig-col field="customer" header="Customer" [sortable]="true" filter="text" />
      <vig-col
        field="amount"
        header="Amount"
        align="end"
        [sortable]="true"
        [filter]="{ type: 'number', rules: 3 }"
      />
      <vig-col field="date" header="Date" [sortable]="true" filter="date" />
    </vig-table>
  `,
})
export class TableFilterMenuDemo {
  protected readonly payments = PAYMENTS;
  // Preset: payments of at least 500, or below 100.
  protected readonly filters = signal<TableFilters>({
    amount: {
      operator: 'or',
      constraints: [
        { matchMode: 'gte', value: 500 },
        { matchMode: 'lt', value: 100 },
      ],
    },
  });
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '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.

```typescript title="table-global-filter.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-global-filter',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments"
      [toolbar]="{ search: true }"
      [(globalFilter)]="search"
      size="sm"
    >
      <vig-col field="customer" header="Customer" />
      <vig-col field="region" header="Region" />
      <vig-col field="status" header="Status" />
    </vig-table>
    <p class="text-sm text-muted-foreground">Search: "{{ search() }}"</p>
  `,
})
export class TableGlobalFilterDemo {
  protected readonly payments = PAYMENTS;
  protected readonly search = signal('');
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Computed columns

A typed `[value]` accessor replaces `row[field]` for display, sorting, filtering, search and CSV — no string paths. `field` then only names the column.

```typescript title="table-value-accessor.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS, type Payment } from './payments';

@Component({
  selector: 'app-table-value-accessor',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments with tax" [items]="payments" size="sm">
      <vig-col field="customer" header="Customer" [sortable]="true" />
      <vig-col
        field="gross"
        header="Gross"
        align="end"
        [value]="gross"
        [sortable]="true"
        filter="number"
      />
    </vig-table>
  `,
})
export class TableValueAccessorDemo {
  protected readonly payments = PAYMENTS.slice(0, 6);
  // Typed: sorting, filtering, search and CSV export all read this.
  protected readonly gross = (payment: Payment) => Math.round(payment.amount * 1.2 * 100) / 100;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-multi-sort.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn, type TableSort } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-multi-sort',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments" sortMode="multiple" [(sorts)]="sort">
      <vig-col field="region" header="Region" [sortable]="true" />
      <vig-col field="status" header="Status" [sortable]="true" />
      <vig-col field="amount" header="Amount" align="end" [sortable]="true" />
    </vig-table>
    <p class="text-sm text-muted-foreground">
      Shift+click a header to add it. Order: {{ order() || 'none' }}
    </p>
  `,
})
export class TableMultiSortDemo {
  protected readonly payments = PAYMENTS.slice(0, 8);
  protected readonly sort = signal<TableSort[]>([
    { field: 'region', direction: 'asc' },
    { field: 'amount', direction: 'desc' },
  ]);
  protected order(): string {
    return this.sort()
      .map((sort) => `${sort.field} ${sort.direction}`)
      .join(', ');
  }
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-column-toggle.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-column-toggle',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments" [toolbar]="{ columns: true }" size="sm">
      <vig-col field="customer" header="Customer" [rowHeader]="true" />
      <vig-col field="amount" header="Amount" align="end" />
      <vig-col field="region" header="Region" [hidden]="true" />
      <vig-col field="status" header="Status" />
      <vig-col field="date" header="Date" />
    </vig-table>
  `,
})
export class TableColumnToggleDemo {
  protected readonly payments = PAYMENTS.slice(0, 5);
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-column-resize.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn, TableColumnResizeEvent } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-column-resize',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments"
      [resizableColumns]="true"
      columnResizeMode="expand"
      state="docs-table-widths"
      (columnResized)="last.set($event)"
    >
      <vig-col field="customer" header="Customer" [rowHeader]="true" [minWidth]="120" />
      <vig-col field="region" header="Region" />
      <vig-col field="status" header="Status" />
      <vig-col field="amount" header="Amount" align="end" [maxWidth]="200" />
    </vig-table>
    <p class="mt-2 text-sm text-muted-foreground" aria-live="off">
      @if (last(); as event) {
        {{ event.field }}: {{ event.width }}px
      } @else {
        Drag a header edge, or Tab to it and press the arrow keys.
      }
    </p>
  `,
})
export class TableColumnResizeDemo {
  protected readonly payments = PAYMENTS.slice(0, 4);
  protected readonly last = signal<TableColumnResizeEvent | null>(null);
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-column-reorder.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-column-reorder',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments" [reorderableColumns]="true" size="sm">
      <vig-col field="customer" header="Customer" [rowHeader]="true" />
      <vig-col field="region" header="Region" />
      <vig-col field="status" header="Status" />
      <vig-col field="amount" header="Amount" align="end" />
    </vig-table>
  `,
})
export class TableColumnReorderDemo {
  protected readonly payments = PAYMENTS.slice(0, 4);
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-frozen-columns.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-frozen-columns',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <div class="max-w-md">
      <vig-table
        caption="Payments"
        [items]="payments"
        selectionMode="multiple"
        [stickyHeader]="true"
        scrollHeight="16rem"
        [resizableColumns]="true"
      >
        <vig-col field="customer" header="Customer" [rowHeader]="true" frozen="start" />
        <vig-col field="id" header="Invoice" />
        <vig-col field="region" header="Region" />
        <vig-col field="date" header="Date" />
        <vig-col field="status" header="Status" />
        <vig-col field="amount" header="Amount" align="end" frozen="end" />
      </vig-table>
    </div>
  `,
})
export class TableFrozenColumnsDemo {
  protected readonly payments = PAYMENTS;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Cell editing

Mark columns `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).

```typescript title="table-cell-editing.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import {
  Table,
  TableCellEditEvent,
  TableCellEditor,
  TableColumn,
  cellValidator,
} from '@vigdx/ui/table';

import { PAYMENTS, Payment, PaymentStatus } from './payments';

@Component({
  selector: 'app-table-cell-editing',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn, TableCellEditor],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments()"
      [rowId]="rowId"
      size="sm"
      (cellEdited)="save($event)"
    >
      <vig-col
        field="customer"
        header="Customer"
        [rowHeader]="true"
        editable
        [validate]="required"
      />
      <vig-col field="region" header="Region" />
      <vig-col field="status" header="Status" editable>
        <ng-template
          [vigTableCellEditor]="statusOf"
          let-status
          let-commit="commit"
          let-label="ariaLabel"
        >
          <select
            class="w-full rounded-input border border-border-control bg-background px-1 text-sm text-foreground pointer-coarse:text-base"
            [attr.aria-label]="label"
            (change)="commit(statusIn($event))"
          >
            @for (option of statuses; track option) {
              <option [value]="option" [selected]="option === status">{{ option }}</option>
            }
          </select>
        </ng-template>
      </vig-col>
      <vig-col
        field="amount"
        header="Amount"
        align="end"
        editable
        editType="number"
        [validate]="positive"
      />
    </vig-table>
  `,
})
export class TableCellEditingDemo {
  protected readonly payments = signal(PAYMENTS.slice(0, 5));
  protected readonly rowId = (payment: Payment) => payment.id;
  protected readonly statuses: PaymentStatus[] = ['paid', 'pending', 'failed'];
  protected readonly statusOf = (payment: Payment) => payment.status;
  protected readonly required = cellValidator((customer: string) =>
    customer.trim() ? null : 'Enter a customer',
  );
  protected readonly positive = cellValidator((amount: number | null) =>
    amount !== null && amount > 0 ? null : 'Enter an amount above 0',
  );

  /** The table never changes your rows: replace the edited one, then the array. */
  protected save({ row, field, value }: TableCellEditEvent<Payment>): void {
    this.payments.update((all) =>
      all.map((payment) => (payment === row ? { ...payment, [field]: value } : payment)),
    );
  }

  protected statusIn(event: Event): PaymentStatus {
    return (event.target as HTMLSelectElement).value as PaymentStatus;
  }
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-row-reorder.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn, TableRowReorderEvent } from '@vigdx/ui/table';

import { PAYMENTS, Payment } from './payments';

@Component({
  selector: 'app-table-row-reorder',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payment queue"
      [items]="queue()"
      [rowId]="rowId"
      [reorderableRows]="true"
      size="sm"
      (rowReordered)="moved($event)"
    >
      <vig-col field="customer" header="Customer" [rowHeader]="true" />
      <vig-col field="region" header="Region" />
      <vig-col field="amount" header="Amount" align="end" />
    </vig-table>
    <p class="mt-2 text-sm text-muted-foreground">Last move: {{ lastMove() }}</p>
  `,
})
export class TableRowReorderDemo {
  protected readonly queue = signal(PAYMENTS.slice(0, 5));
  protected readonly rowId = (payment: Payment) => payment.id;
  protected readonly lastMove = signal('none yet');

  /** The table never reorders your array: `rowReordered` carries the new one. */
  protected moved(event: TableRowReorderEvent<Payment>): void {
    this.queue.set(event.items);
    this.lastMove.set(`${event.row.customer}, ${event.from + 1} → ${event.to + 1}`);
  }
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-export.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Button, ButtonIcon } from '@vigdx/ui/button';
import { Icon } from '@vigdx/ui/icon';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-export',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Button, ButtonIcon, Icon, Table, TableColumn],
  template: `
    <div class="flex flex-wrap gap-2">
      <vig-button
        label="Download CSV"
        size="sm"
        (click)="table.exportCsv({ filename: 'payments' })"
      >
        <vig-icon vigButtonIcon name="download" />
      </vig-button>
      <vig-button
        label="Preview"
        size="sm"
        variant="secondary"
        (click)="preview.set(table.exportCsv({ download: false, bom: false }))"
      />
    </div>
    <vig-table #table caption="Payments" [items]="payments" size="sm">
      <vig-col field="customer" header="Customer" filter="text" />
      <vig-col field="amount" header="Amount" align="end" />
      <vig-col field="status" header="Status" />
    </vig-table>
    @if (preview()) {
      <pre class="overflow-x-auto rounded-card bg-subtle p-3 text-xs">{{ preview() }}</pre>
    }
  `,
})
export class TableExportDemo {
  protected readonly payments = PAYMENTS.slice(0, 4);
  protected readonly preview = signal('');
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

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

```typescript title="table-state.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS, type Payment } from './payments';

@Component({
  selector: 'app-table-state',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments"
      [rowId]="rowId"
      [state]="{ key: 'docs-table-payments', storage: 'session' }"
      [toolbar]="{ search: true, columns: true }"
      [paginator]="true"
      [rows]="4"
      size="sm"
    >
      <vig-col field="customer" header="Customer" [sortable]="true" />
      <vig-col field="amount" header="Amount" align="end" [sortable]="true" />
      <vig-col field="status" header="Status" />
    </vig-table>
  `,
})
export class TableStateDemo {
  protected readonly payments = PAYMENTS;
  protected readonly rowId = (payment: Payment) => payment.id;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Server-side data

Server mode is one line: feed `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.

```typescript title="table-server-side.ts"
import {
  ChangeDetectionStrategy,
  Component,
  computed,
  Injectable,
  inject,
  resource,
  viewChild,
} from '@angular/core';
import { FilterMatcher } from '@vigdx/ui/core';
import { Table, TableColumn, type TableLazyLoadEvent } from '@vigdx/ui/table';

import { PAYMENTS, type Payment } from './payments';

/** Stands in for an HTTP API: filters, sorts and pages after a short delay. */
@Injectable({ providedIn: 'root' })
export class FakePaymentsApi {
  private readonly matcher = inject(FilterMatcher);

  async list(
    state: TableLazyLoadEvent,
    abortSignal: AbortSignal,
  ): Promise<{ rows: Payment[]; total: number }> {
    await new Promise((resolve) => setTimeout(resolve, 300));
    abortSignal.throwIfAborted();
    const rows = this.matcher.filter(PAYMENTS, state.filters ?? {}, {
      globalFilter: state.globalFilter,
      globalFields: ['customer', 'region'],
    });
    const sorts = state.sorts ?? (state.sort ? [state.sort] : []);
    const sorted = rows.toSorted((a, b) => {
      for (const { field, direction } of sorts) {
        const x = a[field as keyof Payment];
        const y = b[field as keyof Payment];
        if (x !== y) return (x < y ? -1 : 1) * (direction === 'asc' ? 1 : -1);
      }
      return 0;
    });
    return { rows: sorted.slice(state.first, state.first + state.rows), total: sorted.length };
  }
}

@Component({
  selector: 'app-table-server-side',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payments"
      [lazy]="true"
      [items]="rows()"
      [totalRecords]="total()"
      [loading]="page.isLoading()"
      [paginator]="true"
      [rows]="4"
      sortMode="multiple"
      filterDisplay="menu"
      size="sm"
    >
      <vig-col field="customer" header="Customer" [sortable]="true" filter="text" />
      <vig-col field="amount" header="Amount" align="end" [sortable]="true" filter="number" />
      <vig-col field="region" header="Region" [sortable]="true" />
    </vig-table>
  `,
})
export class TableServerSideDemo {
  private readonly table = viewChild(Table<Payment>);
  private readonly api = inject(FakePaymentsApi);

  // The whole server contract: one typed state object in, one page out.
  protected readonly page = resource({
    params: () => this.table()?.lazyState(),
    loader: ({ params, abortSignal }) => this.api.list(params, abortSignal),
  });
  protected readonly rows = computed(() => (this.page.hasValue() ? this.page.value().rows : []));
  protected readonly total = computed(() =>
    this.page.hasValue() ? this.page.value().total : undefined,
  );
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-layout.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-layout',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments"
      [gridlines]="true"
      [striped]="true"
      [paginator]="true"
      [rows]="4"
      [paginatorOptions]="{ position: 'both', jumpToPage: true }"
      size="sm"
    >
      <vig-col field="id" header="Invoice" width="6rem" />
      <vig-col field="customer" header="Customer" />
      <vig-col field="amount" header="Amount" align="end" />
    </vig-table>
  `,
})
export class TableLayoutDemo {
  protected readonly payments = PAYMENTS;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-selection.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS, type Payment } from './payments';

@Component({
  selector: 'app-table-selection',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments"
      selectionMode="multiple"
      [rowId]="rowId"
      [(selection)]="selected"
    >
      <vig-col field="customer" header="Customer" />
      <vig-col field="status" header="Status" />
      <vig-col field="amount" header="Amount" align="end" />
    </vig-table>
    <p class="text-sm text-muted-foreground" aria-live="polite">
      {{ selected().length }} of {{ payments.length }} selected
    </p>
  `,
})
export class TableSelectionDemo {
  protected readonly payments = PAYMENTS.slice(0, 5);
  protected readonly selected = signal<Payment[]>([]);
  protected readonly rowId = (payment: Payment) => payment.id;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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`.

```typescript title="table-pagination.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-pagination',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="All payments"
      [items]="payments"
      [paginator]="true"
      [rows]="5"
      [rowsPerPageOptions]="[5, 10, 20]"
      size="sm"
    >
      <vig-col field="id" header="Invoice" width="6rem" [sortable]="true" />
      <vig-col field="customer" header="Customer" [sortable]="true" />
      <vig-col field="amount" header="Amount" align="end" [sortable]="true" />
    </vig-table>
  `,
})
export class TablePaginationDemo {
  protected readonly payments = PAYMENTS;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Custom cells

An `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.

```typescript title="table-custom-cells.ts"
import { CurrencyPipe } from '@angular/common';
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Avatar } from '@vigdx/ui/avatar';
import { Badge, type BadgeVariant } from '@vigdx/ui/badge';
import { Button, ButtonIcon } from '@vigdx/ui/button';
import { Icon } from '@vigdx/ui/icon';
import { Table, TableCell, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS, type PaymentStatus } from './payments';

@Component({
  selector: 'app-table-custom-cells',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [CurrencyPipe, Avatar, Badge, Button, ButtonIcon, Icon, Table, TableCell, TableColumn],
  template: `
    <vig-table caption="Payments" [items]="payments">
      <vig-col header="Customer">
        <ng-template vigTableCell let-payment>
          <span class="flex items-center gap-2">
            <vig-avatar [name]="payment.customer" size="sm" />
            {{ payment.customer }}
          </span>
        </ng-template>
      </vig-col>
      <vig-col header="Status">
        <ng-template vigTableCell let-payment>
          <vig-badge [label]="payment.status" [variant]="tone(payment.status)" [dot]="true" />
        </ng-template>
      </vig-col>
      <vig-col header="Amount" align="end">
        <ng-template vigTableCell let-payment>
          <span class="font-mono tabular-nums">{{ payment.amount | currency: 'EUR' }}</span>
        </ng-template>
      </vig-col>
      <vig-col header="Actions" align="end">
        <ng-template vigTableCell let-payment>
          <vig-button
            appearance="text"
            variant="secondary"
            size="xs"
            [ariaLabel]="'More actions for invoice ' + payment.id"
          >
            <vig-icon vigButtonIcon name="more-horizontal" />
          </vig-button>
        </ng-template>
      </vig-col>
    </vig-table>
  `,
})
export class TableCustomCellsDemo {
  protected readonly payments = PAYMENTS.slice(0, 5);
  protected tone(status: PaymentStatus): BadgeVariant {
    return status === 'paid' ? 'success' : status === 'pending' ? 'warning' : 'error';
  }
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Row expansion

A `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`.

```typescript title="table-row-expansion.ts"
import { ChangeDetectionStrategy, Component, signal } from '@angular/core';
import { Table, TableColumn, TableRowExpansion } from '@vigdx/ui/table';

import { PAYMENTS, type Payment } from './payments';

@Component({
  selector: 'app-table-row-expansion',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn, TableRowExpansion],
  template: `
    <vig-table
      caption="Payments"
      [items]="payments"
      [rowId]="rowId"
      [rowExpandable]="hasDetails"
      [(expandedRows)]="expanded"
    >
      <vig-col field="customer" header="Customer" />
      <vig-col field="status" header="Status" />
      <vig-col field="amount" header="Amount" align="end" />
      <ng-template vigTableRowExpansion let-payment>
        <p class="text-sm text-foreground-soft">
          Invoice #{{ payment.id }} for {{ payment.customer }} ({{ payment.region }}), settled on
          {{ payment.date }}.
        </p>
      </ng-template>
    </vig-table>
  `,
})
export class TableRowExpansionDemo {
  protected readonly payments = PAYMENTS.slice(0, 5);
  protected readonly expanded = signal<Payment[]>([PAYMENTS[0]]);
  protected readonly rowId = (payment: Payment) => payment.id;
  // Pending payments have nothing to show yet.
  protected readonly hasDetails = (payment: Payment) => payment.status !== 'pending';
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-sticky-header.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS } from './payments';

@Component({
  selector: 'app-table-sticky-header',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Table, TableColumn],
  template: `
    <vig-table
      caption="Payment history"
      [items]="payments"
      [stickyHeader]="true"
      scrollHeight="16rem"
      [rowHover]="true"
    >
      <vig-col field="id" header="Invoice" width="6rem" />
      <vig-col field="customer" header="Customer" />
      <vig-col field="date" header="Date" />
      <vig-col field="amount" header="Amount" align="end" />
    </vig-table>
  `,
})
export class TableStickyHeaderDemo {
  protected readonly payments = PAYMENTS;
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## 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.

```typescript title="table-virtual-scroll.ts"
import { ChangeDetectionStrategy, Component, signal, viewChild } from '@angular/core';
import { Button } from '@vigdx/ui/button';
import { Table, TableColumn } from '@vigdx/ui/table';

import { PAYMENTS, type Payment } from './payments';

/** 100,000 payments made from the sample rows. */
function manyPayments(): Payment[] {
  return Array.from({ length: 100_000 }, (_, i) => ({
    ...PAYMENTS[i % PAYMENTS.length],
    id: i + 1,
    amount: (i * 7919) % 5000,
  }));
}

@Component({
  selector: 'app-table-virtual-scroll',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Button, Table, TableColumn],
  host: { class: 'flex flex-col gap-3', style: '--vig-table-height: 20rem' },
  template: `
    <vig-table
      caption="All payments"
      [items]="payments"
      [rowId]="rowId"
      virtualScroll
      selectionMode="multiple"
      [(selection)]="selected"
    >
      <vig-col field="id" header="Invoice" width="6rem" [sortable]="true" />
      <vig-col field="customer" header="Customer" [rowHeader]="true" width="12rem" />
      <vig-col field="region" header="Region" />
      <vig-col field="amount" header="Amount" align="end" [sortable]="true" />
    </vig-table>
    <div class="flex flex-wrap items-center gap-3">
      <vig-button
        size="sm"
        appearance="outlined"
        label="Go to invoice 50,000"
        (mousedown)="$event.preventDefault()"
        (click)="table().scrollToIndex(49_999)"
      />
      <span class="text-sm text-muted-foreground" aria-live="polite">
        {{ selected().length }} of {{ payments.length }} selected
      </span>
    </div>
  `,
})
export class TableVirtualScrollDemo {
  protected readonly payments = manyPayments();
  protected readonly selected = signal<Payment[]>([]);
  protected readonly rowId = (payment: Payment) => payment.id;
  protected readonly table = viewChild.required(Table<Payment>);
}
```

```typescript title="payments.ts"
export type PaymentStatus = 'paid' | 'pending' | 'failed';

export interface Payment {
  id: number;
  customer: string;
  amount: number;
  status: PaymentStatus;
  region: string;
  date: string;
}

/** Sample rows shared by the table demos. */
export const PAYMENTS: Payment[] = [
  {
    id: 1042,
    customer: 'Deniz Aksoy',
    amount: 1250,
    status: 'paid',
    region: 'Europe',
    date: '2026-03-02',
  },
  {
    id: 1041,
    customer: 'Aylin Kaya',
    amount: 89,
    status: 'pending',
    region: 'Europe',
    date: '2026-03-01',
  },
  {
    id: 1040,
    customer: 'Can Demir',
    amount: 430,
    status: 'paid',
    region: 'Asia',
    date: '2026-02-27',
  },
  {
    id: 1039,
    customer: 'Mia Wong',
    amount: 2210,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-25',
  },
  {
    id: 1038,
    customer: 'Lucas Martin',
    amount: 64.5,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-24',
  },
  {
    id: 1037,
    customer: 'Sofia Rossi',
    amount: 980,
    status: 'paid',
    region: 'Europe',
    date: '2026-02-20',
  },
  {
    id: 1036,
    customer: 'Omar Haddad',
    amount: 150,
    status: 'pending',
    region: 'Africa',
    date: '2026-02-18',
  },
  {
    id: 1035,
    customer: 'Emma Johnson',
    amount: 3120,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-15',
  },
  {
    id: 1034,
    customer: 'Kenji Sato',
    amount: 47,
    status: 'failed',
    region: 'Asia',
    date: '2026-02-11',
  },
  {
    id: 1033,
    customer: 'Ana Silva',
    amount: 615,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-09',
  },
  {
    id: 1032,
    customer: 'Noah Smith',
    amount: 288,
    status: 'paid',
    region: 'Americas',
    date: '2026-02-04',
  },
  {
    id: 1031,
    customer: 'Zeynep Arslan',
    amount: 1999,
    status: 'pending',
    region: 'Europe',
    date: '2026-02-01',
  },
];
```

## Empty state

With no rows the table shows `emptyMessage`, or a `vigTableEmpty` template such as an empty state with a next step.

```typescript title="table-empty.ts"
import { ChangeDetectionStrategy, Component } from '@angular/core';
import { Button } from '@vigdx/ui/button';
import { EmptyState, EmptyStateActions } from '@vigdx/ui/empty-state';
import { Table, TableColumn, TableEmpty } from '@vigdx/ui/table';

@Component({
  selector: 'app-table-empty',
  changeDetection: ChangeDetectionStrategy.OnPush,
  imports: [Button, EmptyState, EmptyStateActions, Table, TableColumn, TableEmpty],
  template: `
    <vig-table caption="Payments" [items]="[]">
      <vig-col field="customer" header="Customer" />
      <vig-col field="amount" header="Amount" align="end" />
      <ng-template vigTableEmpty>
        <vig-empty-state
          size="sm"
          icon="inbox"
          heading="No payments yet"
          description="Payments you record will be listed here."
        >
          <div vigEmptyStateActions class="contents">
            <vig-button label="Record payment" size="sm" />
          </div>
        </vig-empty-state>
      </ng-template>
    </vig-table>
  `,
})
export class TableEmptyDemo {}
```

## 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:

```typescript
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 `labels` input, merged over the locale defaults of `provideVigdxUi` (English and Turkish built in). Visible texts end in `…Label`, screen-reader-only ones in `…AriaLabel`, status messages in `…Announcement` and placeholders in `…Placeholder`. These keys are optional on `VigdxLabels`, 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, with `register(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; use `lazy` with 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](https://vigdx.com/docs/theming.md#customizing).

### Table `[data-scope="table"]`

| Part | Element | data-state |
| --- | --- | --- |
| `toolbar` | Row above the table: search and column toggle. |   |
| `search` | The built-in global search field. |   |
| `filter-indicator` | Notice of active filters on hidden columns. |   |
| `frame` | The bordered frame around the table. |   |
| `loading` | The loading overlay. |   |
| `scroll` | The scroll region. |   |
| `table` | The native `<table>`. |   |
| `head` | The `<thead>`. |   |
| `header-cell` | A column header `<th>` (`aria-sort`; `data-frozen="start\|end"` when frozen, like every frozen cell). |   |
| `resize-handle` | The resize handle at the end of a resizable header (`role="separator"`, `resizableColumns`). | `dragging` |
| `sort` | The sort button of a sortable header. |   |
| `sort-priority` | The priority number of a column in a multi-sort. |   |
| `sort-priority-label` | The visually hidden text that reads the priority out. |   |
| `add-to-sort` | The control that adds a column to a multi-sort. |   |
| `filter-row` | The row of filter editors (`filterDisplay="row"`). |   |
| `filter-trigger` | A column filter menu button (`filterDisplay="menu"`). |   |
| `filter-panel` | The filter menu form, in a popover panel in the overlay container. |   |
| `clear-selection` | The button that clears a single selection. |   |
| `body` | The `<tbody>`. |   |
| `spacer` | A virtual table (`virtualScroll`): the `aria-hidden` row standing in for the rows above or below the rendered ones. |   |
| `group-header` | A group header row (`groupBy`). |   |
| `row` | A data row. | `selected` |
| `row-handle` | The move handle of a row (`reorderableRows`): drag it, Alt+ArrowUp/ArrowDown on it, or click it for its move menu. |   |
| `select` | The selection checkbox or radio of a row. |   |
| `select-all` | The header checkbox that selects every row of the page (multiple selection). |   |
| `expand` | The expand button of a row. |   |
| `cell` | A data cell, `<td>` or row-header `<th>` (`data-frozen="start\|end"` when frozen). | `editing` |
| `editor` | The default editor of a cell being edited (an `editable` column). |   |
| `editor-error` | The validation error under a cell editor (`aria-describedby` of the editor). |   |
| `expansion` | The detail row of an expanded row. |   |
| `toggle` | The expand button of a tree row (`rowChildren`; `aria-expanded`, no Tab stop of its own). | `open, closed` |
| `children-loading` | The busy ring in place of the chevron while a row's children load. |   |
| `children-error` | The row under a tree row whose children failed to load. |   |
| `retry` | The retry button of that row. |   |
| `empty` | The empty-message row. |   |
| `paginator` | A `vig-paginator` (top and bottom). |   |

### TableColumnToggle `[data-scope="table"]`

| Part | Element | data-state |
| --- | --- | --- |
| `column-toggle` | The column visibility menu (on the host). |   |
| `column-move-left` | The "Move left" button of a column (`reorderableColumns`). |   |
| `column-move-right` | The "Move right" button of a column (`reorderableColumns`). |   |
| `column-narrow` | The "Narrower" button of a resizable column. |   |
| `column-widen` | The "Wider" button of a resizable column. |   |
| `column-reset-widths` | The "Reset widths" button (resizable columns). |   |

## Accessibility

- Renders a native `<table>` with `<th scope="col">` headers; `caption` becomes 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 for `multiple`, 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 expose `aria-expanded` and `aria-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 (or `scrollRegionAriaLabel`), 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 its `aria-rowindex`, so screen readers announce "row 5,002 of 100,001". The spacer rows around the window are `aria-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's `scroll-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"` with `aria-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 through `aria-labelledby`, so cells never read the handle's name. Pointer drags capture the pointer; only the handle sets `touch-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 `editable` columns is an APG editable grid (`role="grid"`, named by the caption): one Tab stop on a cell (a roving `tabindex`), 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 carry `aria-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 sets `aria-invalid` and `aria-describedby` on 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's `commit`, 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`) with `aria-haspopup="menu"` and `aria-keyshortcuts`; its hit area is 24px (44px on coarse pointers) and only it sets `touch-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 surrounding `cdkDropListGroup` and 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 at `z-index: 1` and 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 while `reorderableColumns` is on (no document touch listener otherwise) and joins no surrounding `cdkDropListGroup`.
- 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-sort` on 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 is `aria-busy` and shows a `vig-spinner` named `loadingAriaLabel`. Every built-in label is an input for i18n.

## API

### Table

Selector: `vig-table` · Kind: component

Data 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

#### Inputs

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `caption` | `string \| undefined` | `undefined` | Accessible table name, rendered as a visually hidden caption. |
| `cascade` | `boolean` | `true` | Tree table with `selectionMode="multiple"`: checking a row checks its selectable descendants, and a parent shows checked, unchecked or mixed from them; `selection` lists every checked row, implied ones included (a parent set from outside, children loaded under a checked row are written back into it). Rows that `rowSelectable` rejects keep their own state and pass the cascade through. Off, every checkbox stands alone. |
| `clearSelectionAriaLabel` | `string \| undefined` | `undefined` | Name of the single-selection column's clear button (i18n). |
| `collapseRowAriaLabel` | `string \| undefined` | `undefined` | — |
| `columnResizeMode` | `TableColumnResizeMode` | `'fit'` | `fit` (default) keeps the table width: the next column gives or takes the difference. `expand` changes the table width, which then scrolls. |
| `columnVisibility` (model) | `Readonly<Record<string, boolean>>` | — | Visibility per column `field`, over each column's `hidden`. |
| `emptyMessage` | `string \| undefined` | `undefined` | — |
| `expandedRows` (model) | `T[]` | `[]` | Expanded rows of a table with a `vigTableRowExpansion` template, or the expanded parent rows of a tree table (`rowChildren`); identity via `rowId`. |
| `expandRowAriaLabel` | `string \| undefined` | `undefined` | — |
| `filterDisplay` | `TableFilterDisplay` | `'row'` | `row`: a filter row under the header; `menu`: a filter button per header opening a menu. |
| `filters` (model) | `TableFilters` | — | Column filters by column `field`; written by the filter UI, settable from outside. |
| `first` (model) | `number` | `0` | — |
| `globalFilter` (model) | `string` | `''` | Text searched (`contains`) in every visible column, or in `globalFilterFields`. |
| `globalFilterFields` | `readonly string[] \| undefined` | `undefined` | Column fields the global filter searches; every visible column with a `field` by default. |
| `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 `rowChildren` is `undefined` on their first expand (makes the table a tree table on its own too); see `TableChildrenLoader`. Collapsing a loading row, or another loader, cancels the request; a failed load shows a retry row. |
| `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 (`position`) and its jump-to-page field. |
| `paginatorReportPosition` | `PaginatorReportPosition` | `'start'` | — |
| `paginatorSize` | `PaginatorSize` | `'sm'` | — |
| `reorderableColumns` | `boolean` | `false` | Lets users reorder the columns with a `field`: drag a header (a long press on touch screens), or use the move buttons of the column menu, which then shows by default (`toolbar.columns`). The order is kept with `state`. |
| `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 `rowReordered`; set `items` to its `items`. Rows move in the order of `items` among the rows passing the filters, so moving is off while the table is sorted (or loading). A virtual table moves rows by keyboard and menu only; tree tables do not move rows. |
| `resizableColumns` | `boolean` | `false` | Adds a resize handle to the header of every column with a `field` (`vig-col resizable` opts single columns in or out): drag it, or focus it and use the arrow keys. Widths are kept with `state`. |
| `rowChildren` | `TableChildrenAccessor<T> \| undefined` | `undefined` | Makes the table a tree table: the children of a row, e.g. `(f: FileRow) => f.children`. `items` are the root rows; your row objects stay as they are. `[]` or `null` marks a leaf, `undefined` a row whose children `loadChildren` fetches (a leaf without a loader). The table then is an APG treegrid: a toggle in the row-header column (else the first column) expands rows (`expandedRows`), rows are one Tab stop moved by the arrow keys, sorting orders siblings within their parent, filters keep matching rows with their ancestors (shown expanded) and descendants, and the paginator pages the root rows. Row expansion templates and `groupBy` do not apply to tree tables. |
| `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. `(u) => u.id`. |
| `rows` (model) | `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. `24rem` or `60vh`. |
| `scrollRegionAriaLabel` | `string \| undefined` | `undefined` | Name of the scroll region when there is no `caption`. |
| `selectAllAriaLabel` | `string \| undefined` | `undefined` | — |
| `selection` (model) | `T[]` | `[]` | Selected rows; holds at most one entry in single mode. |
| `selectionMode` | `"none" \| "single" \| "multiple"` | `'none'` | `single` adds a radio column and `multiple` a checkbox column, named by the row header (`rowHeader`) or `selectRowAriaLabel`: native controls expose the selection to assistive tech and keyboards, which `aria-selected` on a plain table row does not. A row click also toggles the selection; in single mode the column header offers a clear button (`clearSelectionAriaLabel`). The controls belong to no form (`form=""`), so they are never submitted with, nor submit, a surrounding form. |
| `selectRowAriaLabel` | `string \| undefined` | `undefined` | — |
| `size` | `TableSize` | `'md'` | Row density: vertical cell padding of the body rows. |
| `sort` (model) | `TableSort \| null` | `null` | The sorted column; in `multiple` mode the one with the highest priority. |
| `sortAscendingAnnouncement` | `string \| undefined` | `undefined` | Status announced after an ascending sort; `{0}` is the column header. |
| `sortDescendingAnnouncement` | `string \| undefined` | `undefined` | Status announced after a descending sort; `{0}` is the column header. |
| `sortIndicator` | `TableSortIndicator` | `'always'` | `always` marks every sortable header with a faint sort glyph; `active` shows only the sorted column's arrow and reveals the glyph of the others on hover or keyboard focus. |
| `sortMode` | `"single" \| "multiple"` | `'single'` | `multiple` sorts by several columns: Shift+click (or Shift+Enter, Ctrl/Cmd+click) on a header adds it after the others, headers show each column's priority, and a third press removes a column's sort. A plain click sorts by that column alone. |
| `sorts` (model) | `TableSort[]` | `[]` | Every sorted column in priority order: the source of truth in `sortMode="multiple"`, where `sort` mirrors its first entry. Writing `sort` from outside in multiple mode sorts by that column alone. |
| `state` | `TableStateOptions \| undefined` | `undefined` | Keeps sort, filters, page, page size, column visibility and expanded rows across visits: a storage key (`localStorage`), or `{ key, storage }`. Restored in the browser right after the first render — never on the server, so hydration matches — and read once. |
| `stickyHeader` | `boolean` | `false` | Keeps the header row in view while the body scrolls (set `scrollHeight` too). |
| `striped` | `boolean` | `false` | Alternating row fills. |
| `toolbar` | `TableToolbar` | — | Built-in controls above the table: `{ search: true, columns: true }`. |
| `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: `true`, or `'auto'`, which windows the rows from `TABLE_VIRTUAL_THRESHOLD` rows on. Either value gives the table its virtual layout at any row count, so crossing the threshold changes no layout: the body scrolls within `scrollHeight`, else the `--vig-table-height` token (24rem); the header is sticky; columns keep their widths while scrolling (`table-layout: fixed`: give columns a `width`, the others share the rest, at least `--vig-table-column-min-width` each, and the table scrolls sideways below that); cells stay on one line, ending in an ellipsis, since every row has one measured height (the full text stays in the DOM for screen readers, and plain cells show it as a title). The focused row stays rendered wherever the view goes. With the paginator it renders the page's rows. Does not apply to tables with a `vigTableRowExpansion` template (a dev-mode warning says so). |

#### Outputs

| Name | Payload | Description |
| --- | --- | --- |
| `cellEdited` | `TableCellEditEvent<T>` | A committed cell edit of an `editable` column. The table never changes your rows: update `items` immutably, e.g. `items.update((all) => all.map((r) => (r === row ? { ...r, [field]: value } : r)))`. |
| `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 `field`, over each column's `hidden`. |
| `expandedRowsChange` | `T[]` | Expanded rows of a table with a `vigTableRowExpansion` template, or the expanded parent rows of a tree table (`rowChildren`); identity via `rowId`. |
| `filtersChange` | `TableFilters` | Column filters by column `field`; written by the filter UI, settable from outside. |
| `firstChange` | `number` | — |
| `globalFilterChange` | `string` | Text searched (`contains`) in every visible column, or in `globalFilterFields`. |
| `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 (`reorderableRows`): set `items` to the event's `items`. |
| `rowsChange` | `number` | — |
| `selectionChange` | `T[]` | Selected rows; holds at most one entry in single mode. |
| `sortChange` | `TableSort \| null` | The sorted column; in `multiple` mode the one with the highest priority. |
| `sortsChange` | `TableSort[]` | Every sorted column in priority order: the source of truth in `sortMode="multiple"`, where `sort` mirrors its first entry. Writing `sort` from outside in multiple mode sorts by that column alone. |

#### Methods

| 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 `field` (read through `value`), every row passing the filters in the current sort order (all pages; the loaded rows in lazy mode), a UTF-8 BOM for Excel, and spreadsheet-formula neutralisation (see `CsvOptions.sanitize`). Returns the CSV text. |
| `isColumnVisible(column: TableColumn): boolean` | Whether the column shows: its `columnVisibility` override, else not `hidden`. Keyless columns always show. |
| `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 `loadChildren` loaded for `row` and below it, or for every row without one, and cancels those loads: expanded rows load again, the others on their next expand. For data that changed on the server. |
| `scrollToIndex(index: number): void` | Scrolls the display row at `index` (the page's rows in display order; in a tree table the rows on screen, depth first) into view, at the top of a virtual table, which renders it first. Focus stays where it is. |
| `scrollToRow(row: T): boolean` | Scrolls `row` into view (see `scrollToIndex`). Returns `false` when it is not among the rows on screen: filtered out, on another page, or under a collapsed parent. |
| `setColumnVisible(column: TableColumn, visible: boolean): void` | Shows or hides a column (writes `columnVisibility`). Hiding a filtered column keeps its filter — hiding is a view change, not a request for other rows — and the toolbar then shows how many filters are active on hidden columns, with a "Clear filters" button; the change is announced. |
| `trackRow(row: T): unknown` | — |

### TableColumn

Selector: `vig-col` · Kind: component

Declares one table column. Renders nothing itself — vig-table reads the inputs and the optional cell template:

**Example :**

```html
<vig-col field="name" header="Name" [sortable]="true" />
<vig-col header="Actions">
  <ng-template vigTableCell let-row let-i="rowIndex">…</ng-template>
</vig-col>
```

#### Inputs

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `"start" \| "center" \| "end" \| "left" \| "right"` | `'left'` | Text alignment of the column's cells and header. `start`/`end` follow the text direction. `left`/`right` are deprecated aliases of them: they always aligned logically too (`right` is the left edge under RTL). |
| `editable` | `boolean` | `false` | Lets users edit the column's cells (needs a `field`, which `cellEdited` reports): Enter, F2, a double click or typing on a cell opens the default text input (a number input for number values), or the column's `vigTableCellEditor` template. The table then is an APG grid. |
| `editType` | `TableCellEditType \| undefined` | `undefined` | The default editor of an `editable` column: `number` parses the text in the locale and commits `number \| null` (also from an empty cell), `text` commits the text. Unset, it follows the cell's value: a number edits as a number, anything else (`null` too) as text. |
| `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 `field`): `filter="text"`, or a typed config such as `[filter]="{ type: 'select', options: statuses }"`. Rendered in the filter row or as a filter menu, per the table's `filterDisplay`. |
| `frozen` | `TableColumnFrozen \| undefined` | `undefined` | Keeps the column in view while the table scrolls horizontally, pinned to the inline `start` (with the selection and expansion columns) or `end`; logical, so it follows the text direction. Frozen columns render first (or last) and are reordered only among themselves. A bare `frozen` attribute means `start`. |
| `header` | `string` | `''` | — |
| `hidden` | `boolean` | `false` | Starts the column hidden; the column menu or `columnVisibility` can show it. Needs a `field`, the column's stable key (header text changes with the language): without one the column stays visible. |
| `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 (`true`) or none (`false`) whatever the table's `resizableColumns`; unset, it follows the table. Needs a `field`, the key its width is kept by. |
| `rowHeader` | `boolean` | `false` | Renders this column's cells as row headers (`<th scope="row">`), e.g. a name column. They also complete the names of the row's selection checkbox and expand button ("Select row Alice"); the first such column wins. |
| `sortable` | `boolean` | `false` | — |
| `validate` | `TableCellValidator \| undefined` | `undefined` | Checks an edited value before it is committed: an error message keeps the editor open showing it, `null` accepts the value. |
| `value` | `TableValueAccessor \| undefined` | `undefined` | Typed accessor of the cell value, e.g. `[value]="total"` with `total = (o: Order) => o.price * o.quantity`. Used instead of `row[field]` for display (without a cell template), sorting, filtering, global search and CSV export; `field` then only names the column (its key in `sort`, `filters` and the persisted state). |
| `width` | `string \| undefined` | `undefined` | Any CSS width, e.g. '12rem' or '20%'. |

### TableCellEditor

Selector: `ng-template[vigTableCellEditor]` · Kind: directive

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

**Example :**

```html
<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>
```

#### Inputs

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `vigTableCellEditor` | `((row: T) => V) \| '' \| undefined` | `undefined` | Reads the value the editor starts from; types the template context. |

### TableColumnToggle

Selector: `vig-table-column-toggle` · Kind: component

A "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:

**Example :**

```html
<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).

#### Inputs

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string \| undefined` | `undefined` | Button label and menu name; `tableColumnToggleLabel` ("Columns") by default. |
| `table` (required) | `TableColumnToggleHost` | — | The table whose columns the menu lists. |

### FilterMatcher

Kind: injectable

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`:

**Example :**

```ts
inject(FilterMatcher).register('even', (value) => Number(value) % 2 === 0);
```

#### Methods

| 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 (`contains`) on any of `globalFields`. Returns the input array itself when nothing filters. |
| `has(mode: string): boolean` | Whether `mode` is a built-in or registered match mode. |
| `match(matchMode: FilterMatchMode, value: unknown, filter: unknown, locale?: string): boolean` | Whether `value` passes one constraint. An empty filter value sets no rule and passes; so does an unknown match mode (with a dev-mode warning), so a stale or crafted filter — e.g. from a shared URL — never breaks a view. |
| `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 (/) around the template. Like every directive, it only applies when the consuming component imports `TableCell` — without the import the template is silently ignored and cells render empty. |
| `[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 :** `<ng-template vigTableRowExpansion let-row>{{ row.notes }}</ng-template>` |
| `[vigTableGroupHeader]` | `TableGroupHeader` | Marks an ng-template as the group subheader; context: group value + first row. |
