@vigdx/ui v2.2.0 on npm (opens in a new tab)

CRUD list

A customer list paged, sorted and filtered on the server: a lazy vig-table with debounced search and a status filter, row actions in a vig-menu , a create and edit vig-dialog with a validated Reactive Form, and delete with the Confirm service and a Toast .

Live demo

The recipe running against its in-memory API (400 ms latency, 57 seeded customers). Turn on server errors to see the error state and the failed-save message.

Customers

Customers
Email Actions
Ada Lovelace [email protected] Northwind Active Jan 1, 2024
Grace Hamilton [email protected] Litware Lead Feb 2, 2025
Linus Ritchie [email protected] Wingtip Inactive Mar 3, 2026
Margaret Torvalds [email protected] Tailspin Active Apr 4, 2024
Alan Liskov [email protected] Fabrikam Lead May 5, 2025
Barbara Hopper [email protected] Contoso Inactive Jun 6, 2026
Dennis Turing [email protected] Northwind Active Jul 7, 2024
Frances Lovelace [email protected] Litware Lead Aug 8, 2025
Ada Hamilton [email protected] Wingtip Inactive Sep 9, 2026
Grace Ritchie [email protected] Tailspin Active Oct 10, 2024

New customer

Invoices and notices go to this address.

Status

A list of records the server pages, sorts and filters, with create, edit and delete. The example manages customers; rename the domain and keep the structure.

When to use

  • A back-office list of records that can grow beyond a few hundred rows, so paging, sorting and filtering must happen on the server.
  • Users search and filter the list, open a record to edit it in place, and delete records.
  • For a handful of rows that never grow, drop lazy and let vig-table page and sort on the client ( [paginator]="true" with all items ); the rest of the recipe stays the same.
  • When editing needs more than a few fields or its own URL, open a routed form page instead of the dialog (see the form-page recipe).

Component choices

Need Component Why Alternatives
The list vig-table with lazy , totalRecords , loading Native table semantics, sortable headers with aria-sort , an embedded paginator, and one lazyLoad event for paging and sorting Cards in a grid when rows are not comparable
Row names vig-col rowHeader The name cell becomes <th scope="row"> , so every row control is announced with its row —
Search vig-input type="search" with hideLabel Keeps the label as the accessible name in a dense toolbar vig-autocomplete to pick one record
Status filter vig-select with clearable Three or more options; clearing means "all" vig-select-button for two or three always-visible choices
Row actions vig-menu behind an icon vig-button Keeps rows compact; the APG menu button pattern Inline text buttons when there are only one or two actions
Create and edit vig-dialog with a Reactive Form Short forms stay in context; the native <dialog> traps focus and restores it A routed form page for long forms
Delete Confirm service One promise-based confirmation, styled destructive with variant: 'error' Undo toast for reversible deletes
Feedback Toast service Non-blocking; queued while a modal is open vig-message for errors that need the user's action
Empty, no-match and error states vigTableEmpty with vig-empty-state Explains the state and offers the next step inside the table emptyMessage for a plain sentence

Folder structure

Angular CLI

Text
src/app/features/customers/
  data-access/
    customer.ts                    domain types and the query
    customers-api.ts               abstract API = DI token
    http-customers-api.ts          HttpClient implementation
    in-memory-customers-api.ts     seeded fake for demos and tests
    customers-store.ts             signal store of the screen
  feature/
    customer-list-page.ts          routed smart page
    customers.routes.ts
  ui/
    customer-filters.ts            presentational
    customer-table.ts              presentational
    customer-form-dialog.ts        presentational

Wire the feature into src/app/app.routes.ts and bind the API there:

app.routes.ts
import { Routes } from '@angular/router';
import { CustomersApi } from './features/customers/data-access/customers-api';
import { HttpCustomersApi } from './features/customers/data-access/http-customers-api';

export const routes: Routes = [
  {
    path: 'customers',
    providers: [{ provide: CustomersApi, useClass: HttpCustomersApi }],
    loadChildren: () =>
      import('./features/customers/feature/customers.routes').then((m) => m.customersRoutes),
  },
];

HttpCustomersApi needs provideHttpClient(withFetch()) in app.config.ts . Without a backend yet, bind InMemoryCustomersApi instead (and list it in providers so it can be injected by class too).

Nx

One library per folder, tagged so the module boundary rule keeps the layers apart:

Terminal
npx nx g @nx/angular:library --directory=libs/customers/data-access --name=customers-data-access --tags=type:data-access,scope:customers --prefix=app --no-interactive
npx nx g @nx/angular:library --directory=libs/customers/feature-list --name=customers-feature-list --tags=type:feature,scope:customers --prefix=app --no-interactive
npx nx g @nx/angular:library --directory=libs/customers/ui --name=customers-ui --tags=type:ui,scope:customers --prefix=app --no-interactive
Text
libs/customers/
  data-access/src/lib/   customer.ts, customers-api.ts, http-customers-api.ts,
                         in-memory-customers-api.ts, customers-store.ts
  feature-list/src/lib/  customer-list-page.ts, customers.routes.ts
  ui/src/lib/            customer-filters.ts, customer-table.ts, customer-form-dialog.ts

Export the public pieces from each library's src/index.ts , replace the relative imports ( ../data-access/customer ) with the library aliases ( @<workspace>/customers-data-access ), and load customersRoutes from the app exactly as in the Angular CLI example. The setup guide for Nx lists the depConstraints that enforce feature → ui, data-access and ui → data-access (types only).

Key decisions

  • The server owns the list. vig-table runs in lazy mode: it renders the page it is given and emits lazyLoad once on start and after every paging or sorting change. The store turns that into the query; totalRecords sizes the paginator.
  • One query signal, one resource. CustomersStore keeps the whole query (offset, page size, sort, search, status) in one signal with a structural equal , and loads it with rxResource . A changed query cancels the request in flight; an unchanged one (the table re-reporting the same page) does not refetch.
  • Debounced search. The input reports every keystroke; the store updates the query 300 ms after typing pauses and jumps back to the first page. Filters also reset to the first page.
  • No flicker. The store keeps the last page on screen while the next one loads, and the table shows its loading overlay on top ( loading also disables the paginator).
  • Refetch after every mutation. Creating, editing or deleting calls the API, then reloads the current page. The server decides where a new or renamed customer sorts and what the total is, so patching the list locally (optimistic updates) would show rows the server would not. Optimistic updates are worth it when latency is high and the list order is stable: update the resource with value.update() , call the API, and reload or roll back on error.
  • Errors stay where the user is. A failed load shows an error state with a retry inside the table. A failed save keeps the dialog open with the user's input and a message; toasts would wait until the dialog closes. A failed delete raises an error toast. Every error text is a translatable label ( errorTitle , errorDescription ); the technical error.message never reaches the screen.
  • Dependency inversion. The store and pages depend on the abstract CustomersApi ; the app binds HttpCustomersApi , demos and tests bind InMemoryCustomersApi (seeded, deterministic, with simulated latency and failures).
  • Smart page, dumb UI. CustomerListPage only wires the store to the components and turns events into store calls, confirmations and toasts. The ui/ components take inputs, emit outputs and inject nothing; their texts come in a labels input for translation.

Accessibility

  • The table has a caption , sortable headers announce their sort, and the name column is a row header, so the actions button of each row is named "Actions for Ada Lovelace".
  • Search and status keep their labels as accessible names while hidden ( hideLabel ), inside a search landmark ( role="search" ).
  • The dialog is a native modal <dialog> : focus moves in, stays in, and returns to the button that opened it. A failed submit marks every field touched and moves focus to the first invalid one with focusFirstInvalid ; each error is linked through aria-describedby .
  • The delete confirmation focuses the safe choice, and its accept button is styled destructively. After a delete removes the row (and the button that had focus), focus moves to the page heading ( tabindex="-1" ) instead of falling to <body> .
  • Status badges carry text, not only color; everything works in forced-colors mode because the kit's focus rings and borders do.
  • Every text, including the kit components' labels, can be translated: pass labels to the ui/ components and configure the kit with provideVigdxUi({ locale }) .

Performance

  • Every component is OnPush and reads signals; the page re-renders only what changed.
  • vig-table tracks rows by rowId , so a refetch keeps unchanged rows' DOM.
  • The feature is lazy-loaded with loadChildren ; only the page's chunk loads on navigation.
  • Row menus are built once per page of rows in a computed , not on every change detection.
  • Only one page of rows is ever in memory; the debounce keeps typing from flooding the server.

Definition of done

  • nx build <app> (or ng build ) succeeds without warnings from the feature.
  • nx lint passes, including the module boundary rule in Nx workspaces.
  • The store and page specs pass: initial load, paging and sorting reach the query, debounced search, create with validation errors then success, edit, delete with confirmation, error and retry.
  • axe reports no violations on the page in light and dark mode, with the dialog open too.
  • Keyboard only: search, filter, sort, page, open a row menu, edit, save, delete and cancel.
  • No hard-coded colors; every user-facing text comes from labels or a text constant.

Source files

Are you sure?