Tutorial cover

How to use @jambotron/aria-grid: an accessible data grid for Angular

Abstract

This article is a practical guide to @jambotron/aria-grid, the Angular data grid we use for every table on jambotron.com and in the web client of Synth Mail, our mail server. It does not explain how the grid is built. It shows how to use it: installing the package, describing columns, sorting and paging, selecting rows and running bulk actions, adding row actions, translating the texts and painting the grid in your own theme. Every step is backed by a live demo with three examples and three themes (Jambotron light, Jambotron dark and the Synthwave theme of Synth Mail), deployed on Jambotron from one Docker Compose file.

Keywords: Angular, data grid, Angular Aria, accessibility, sorting, pagination, bulk actions, theming, CSS variables, Docker Compose.


1. Introduction

Admin screens are mostly tables: users, servers, invoices, mailboxes. Each one needs the same things. You sort by a column, move between pages, select several rows and do something with them, and open a menu with actions for one row. Writing this again for every screen gives you tables that each behave a little differently, and accessibility is usually the first thing to break.

@jambotron/aria-grid packs these features into one component:

  • sorting by any column you allow, in three steps: ascending, descending, original order;
  • paging with a page-size picker (10, 25, 50 or 100 rows);
  • row selection with "select all", kept by row key across sorting, paging and data reloads;
  • bulk actions with one confirmation for all rows, an optional required reason and a "done N, failed M" result;
  • row actions: up to two icons in the row, everything else in a "⋮" menu, dangerous actions last and in red;
  • row highlight for "the row whose details are open";
  • keyboard navigation and screen-reader labels from Angular Aria's grid;
  • texts in any language and colors from CSS variables.

The grid works on data that is fully in the browser. It is made for admin lists of hundreds of rows, not for millions.


2. The demo

The demo is a small Angular app with three sections. Each section has a "Show code" toggle with the code that matters.

Section What it shows
1. Columns, sorting, paging Cell templates, a column without sorting, a text filter, the empty state
2. Selection and bulk actions Three bulk actions: one without confirmation, one with a required reason, one with a dangerous confirmation. "Locked" rows fail on purpose
3. Row actions and highlight Icons in the row, the "⋮" menu, disabled and dangerous actions, the open row highlighted

The demo in the Jambotron light theme: servers with sorting, paging and row actions

Two switches sit at the top. Theme switches between Jambotron light, Jambotron dark and Synthwave. Grid language switches the grid's own texts between English and Russian. Both switches use jt-select, the dropdown that comes in the same package.


3. Installation

3.1 Requirements

Angular 22 with @angular/aria, @angular/cdk and @angular/material of the same major version. The grid uses Material for checkboxes, buttons, tooltips, the confirmation dialog and the snack bar.

3.2 The package

The package is on npm under the MIT license. The current version is 0.4.3.

npm install @jambotron/aria-grid @angular/aria @angular/cdk @angular/material

3.3 Styles and icons

Include the grid's styles once in your global stylesheet:

// src/styles.scss
@use '@jambotron/aria-grid/styles/aria-grid';

The grid draws its icons with mat-icon (arrows, the "⋮" menu, paging buttons), so load the Material Icons font in index.html:

<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">

Material components also need a Material theme (mat.theme). If your app has none yet, section 9.3 shows a ready one.


4. The first grid

A grid needs three inputs: the rows, the columns and a function that returns a unique key for each row.

import { Component, signal } from '@angular/core';
import { DatePipe } from '@angular/common';
import { JtGridComponent, JtGridCellDirective, JtGridColumn } from '@jambotron/aria-grid';

interface Server { id: number; name: string; status: 'running' | 'stopped' | 'error'; cpu: number; created: Date; owner: string; }

@Component({
  selector: 'app-servers',
  imports: [JtGridComponent, JtGridCellDirective, DatePipe],
  template: `
    <jt-grid [rows]="servers()" [columns]="columns" [trackBy]="byId" label="Servers">
      <ng-template jtGridCell="status" let-row>
        <span class="chip chip--{{ row.status }}">{{ row.status }}</span>
      </ng-template>
      <ng-template jtGridCell="created" let-row>{{ row.created | date }}</ng-template>
    </jt-grid>
  `
})
export class ServersComponent {
  servers = signal<Server[]>([]);

  columns: JtGridColumn<Server>[] = [
    { key: 'name', label: 'Name', sort: s => s.name },
    { key: 'status', label: 'Status', sort: s => s.status },
    { key: 'cpu', label: 'CPU', sort: s => s.cpu, align: 'end' },
    { key: 'created', label: 'Created', sort: s => s.created },
    { key: 'owner', label: 'Owner' }
  ];

  byId = (s: Server) => s.id;
}

4.1 Columns

Field Meaning
key Column id. It links the column to its cell template and is the default value of the cell
label Header text
sort Function that returns the value to sort by. No sort means the column cannot be sorted
align 'end' aligns the column to the right. Use it for numbers
hiddenLabel Hides the header text on screen and keeps it for screen readers. Use it for icon columns

4.2 Cells

A cell is an <ng-template jtGridCell="key" let-row> inside <jt-grid>. row is the row object. Use any markup, pipes or components in it.

A column without a template shows row[key] as text. In the example above, name and owner need no template.

4.3 The row key

trackBy must return a value that is unique and stable for a row, usually its id. The grid uses it to render rows and to remember which rows are selected. If the key changes when the data reloads, the selection is lost.

4.4 The label

label becomes the table's accessible name. A screen reader announces "Servers, table". Always set it when a page has more than one table.

Tip. Functions passed to the grid (trackBy, sort, and later rowActions, rowSubject, highlight) should be arrow functions in class fields. The grid calls them without your component as this, so a normal method that uses this would break.


5. Sorting, paging and filtering

5.1 Sorting

A column with sort gets a clickable header. Each click moves through three states: ascending, descending, then the original order of rows. The header gets aria-sort, so screen readers announce the order.

sort can return a string, number, boolean, Date, null or undefined:

  • strings are compared the way people read them: api-2 comes before api-10, and case does not matter;
  • numbers and dates are compared by value;
  • empty values (null, undefined, '') go to the end when sorting ascending.

Set the order the grid opens with by using initialSort:

<jt-grid ... [initialSort]="{ key: 'name', direction: 'asc' }">

5.2 Paging

Below the table, the grid shows "1–10 of 137", a "Rows per page" picker (10, 25, 50, 100) and buttons for the first, previous, next and last page. The default is 25 rows per page. Change it with [pageSize]="10".

A list that fits on the smallest page (10 rows or fewer) shows no pager at all. If you want the pager anyway, for example so that a table does not jump when its list grows, set pager="always".

Sorting or changing the page size returns to the first page. If the list gets shorter while you are on its last page, the grid moves back to the new last page.

5.3 Filtering

The grid has no filter of its own. Filter the array and pass the result to rows. The grid keeps the current sort. A computed signal is enough:

filter = signal('');
rows = computed(() => {
  const q = this.filter().trim().toLowerCase();
  return q ? this.all.filter(s => [s.name, s.region, s.owner].some(v => v.includes(q))) : this.all;
});
<input type="search" [value]="filter()" (input)="filter.set($any($event.target).value)" />
<jt-grid [rows]="rows()" ... emptyMessage="No servers match the filter." />

When rows is empty, the grid shows emptyMessage instead of the table. Without emptyMessage it shows nothing. The message uses the class jt-muted, so give that class a color in your styles.


6. Selection and bulk actions

6.1 Turning selection on

Selection appears when you pass bulk actions. A checkbox column appears with "select all" in the header:

import { RowAction, JtGridBulkEvent } from '@jambotron/aria-grid';

bulk: RowAction[] = [
  { value: 'restart', label: 'Restart', icon: 'restart_alt' },
  { value: 'stop', label: 'Stop', icon: 'stop_circle' },
  { value: 'delete', label: 'Delete', icon: 'delete', danger: true }
];
nameOf = (s: Server) => s.name;
<jt-grid [rows]="servers()" [columns]="columns" [trackBy]="byId"
         [bulkActions]="bulk" (bulkAction)="onBulk($event)" [rowSubject]="nameOf" />

When at least one row is selected, a bar slides in above the table. It shows "Selected: N", a button for each bulk action and a button that clears the selection. A danger action has a red button.

How selection behaves:

  • "Select all" selects every row in rows, not only the visible page. A bulk action is usually meant for the whole list. The demo selects all 48 servers across five pages.
  • The selection is stored by the trackBy key. It survives sorting, page changes and a new rows array with the same keys.
  • Rows that disappear from rows (deleted, filtered out) are removed from the selection.
  • rowSubject adds the row's name to the checkbox label ("Select: api-003"), so a screen reader knows which row a checkbox belongs to.

(bulkAction) gives you { action, rows }, the action's value and the selected rows.

6.2 Running the action: JtGridBulkService

You can handle rows yourself. Usually you want the standard flow, and JtGridBulkService does it:

  1. ask once for all rows (optional);
  2. run the action for each row, one after another;
  3. keep going when one row fails;
  4. tell the user "Delete: done 45" and "Delete: failed 3".
private readonly bulkService = inject(JtGridBulkService);

onBulk(e: JtGridBulkEvent<Server>) {
  switch (e.action) {
    case 'restart':
      // no confirm: a safe action runs immediately
      this.bulkService.run({ rows: e.rows, label: 'Restart', run: s => this.api.restart(s.id) })
        .subscribe(() => this.reload());
      break;
    case 'stop':
      // reason: true asks for one required reason for all rows
      this.bulkService.run({
        rows: e.rows, label: 'Stop', reason: true,
        confirm: 'Why are these servers being stopped? The reason goes to their owners.',
        run: (s, reason) => this.api.stop(s.id, reason)
      }).subscribe(() => this.reload());
      break;
    case 'delete':
      this.bulkService.run({
        rows: e.rows, label: 'Delete', danger: true,
        confirm: 'Delete the selected servers? This cannot be undone.',
        run: s => this.api.delete(s.id)
      }).subscribe(({ done, failed }) => this.reload());
      break;
  }
}
Option Meaning
rows The rows to process, usually event.rows
label The action's name. It is used in the dialog title ("Delete: 48"), on its confirm button and in the result message
confirm Text of the confirmation. Without it (and without reason) the action runs with no dialog
danger Red confirm button
reason Asks for a required text reason (up to 500 characters). It is passed to run as the second argument
run (row, reason) => Observable. An error from this Observable marks the row as failed

run() returns an Observable that emits once, with { done: T[], failed: T[] }, after all rows have finished. If the user presses Cancel, it completes without emitting, so your subscribe callback does not run and nothing reloads for no reason.

Rows run one at a time, not in parallel. A list of 50 rows does not send 50 requests to your server at once, and the order of the results is predictable.

While the rows run, the selection bar shows the progress ("Delete: 12 / 48" and a progress bar), and its buttons are locked, so the same action cannot start twice. The service also exposes the running action as a signal, progress, if you want to show it elsewhere.

In the demo, a few servers are marked "locked" and their fake API always fails. Select all 48 and press Delete. The result is "done 45, failed 3", and the three locked servers stay in the table.

6.3 Your own dialog and messages

By default the service uses a Material dialog and a Material snack bar. If your app has its own confirmation dialog and toasts, provide them once:

import { JT_GRID_BULK_UI } from '@jambotron/aria-grid';

providers: [
  {
    provide: JT_GRID_BULK_UI,
    useFactory: () => {
      const confirm = inject(MyConfirmService);
      const toast = inject(MyToastService);
      return {
        // emit the reason ('' when no reason was asked) or null when cancelled
        ask: req => confirm.open({ title: req.title, text: req.message, okLabel: req.confirmLabel, danger: req.danger, askReason: req.reason }),
        success: message => toast.ok(message),
        error: message => toast.error(message)
      };
    }
  }
]

7. Row actions and highlight

7.1 Actions

rowActions is a function that returns the actions for one row, so actions can depend on the row's state:

actionsOf = (s: Server): RowAction[] => [
  { value: 'open', label: 'Open', icon: 'open_in_new', inline: true },
  { value: 'copy', label: 'Copy name', icon: 'content_copy', inline: true },
  s.status === 'running'
    ? { value: 'stop', label: 'Stop', icon: 'stop_circle' }
    : { value: 'start', label: 'Start', icon: 'play_circle' },
  { value: 'rename', label: 'Rename', icon: 'edit', disabled: s.locked },
  { value: 'delete', label: 'Delete', icon: 'delete', danger: true, disabled: s.locked }
];
<jt-grid [rows]="servers()" [columns]="columns" [trackBy]="byId"
         [rowActions]="actionsOf" (rowAction)="onRow($event)" [rowSubject]="nameOf" />

The grid adds an actions column at the end and places the actions by fixed rules:

RowAction field Where the action goes
inline: true An icon button in the row, with the label as a tooltip. Two at most. Extra inline actions go to the menu
(no flags) The "⋮" menu, in the given order
danger: true The menu, always last, after a separator, in red. A dangerous action is never an icon in the row, even with inline
disabled: true Shown but cannot be chosen

These rules give every table in an app the same layout. The most frequent action is one click away, and "Delete" cannot be clicked by accident.

(rowAction) gives you { action, row }:

onRow({ action, row }: JtGridRowEvent<Server>) {
  switch (action) {
    case 'open': this.openedId.set(row.id); break;
    case 'delete':
      if (confirm(`Delete ${row.name}?`)) { this.api.delete(row.id).subscribe(() => this.reload()); }
      break;
  }
}

The grid does not confirm row actions. Confirm dangerous actions in your handler, with your dialog or with confirm() as in the demo.

rowSubject names the row for screen readers. The "⋮" button is announced as "More actions: api-003", not as twenty identical "More actions" buttons.

7.2 Highlight

highlight marks rows that are "current", for example the row whose details panel is open. It is not the same as selection:

openedId = signal<number | null>(null);
isOpen = (s: Server) => s.id === this.openedId();
<jt-grid ... [highlight]="isOpen" />

In the demo, "Open" shows the server's details below the table and highlights its row until you close them.


8. Keyboard and accessibility

The table is an Angular Aria grid and follows the WAI-ARIA grid pattern: the whole table is one Tab stop, and you move inside it with the arrow keys. A table with ten rows of actions does not make the user press Tab thirty times to get past it. We checked the following in the demo with a keyboard only:

Where Keys
Anywhere in the table Tab enters the table, and the next Tab leaves it. Arrow keys move between cells. Home/End go to the first or last cell of the row, Ctrl+Home/Ctrl+End to the first or last cell of the table
Sortable header The arrows land on the sort button. Enter or Space sorts
Checkbox cell The arrows land on the checkbox. Space selects or clears the row
Actions cell One stop for all its buttons. Enter goes inside, with focus on the first button. ←/→ or Tab move between the buttons, and Enter presses one. On "⋮", Enter opens the menu, the arrows move through it and Escape closes it. The next Escape returns to the cell, and the arrows move between cells again

Screen readers get the same structure. Sorted headers have aria-sort. Checkboxes, the actions group and "⋮" are labelled with the row's subject ("Select: web-001", "Actions: web-001", "More actions: web-001"). The table has the name from label.

Controls that you put into your own cell templates (a link, a button) stay ordinary Tab stops.

Animations (rows appearing, the sort arrow turning, the selection bar sliding in) are turned off when the user's system asks for reduced motion (prefers-reduced-motion).

Two things are up to you. Set label on every grid. Set rowSubject whenever the table has selection or row actions.


9. Texts and themes

9.1 Texts in your language

The grid's own texts are in English by default: "Select all", "Rows per page", "Next page", "done", "failed" and so on. Replace any of them with provideJtGridLabels in the app's providers:

// app.config.ts
import { provideJtGridLabels } from '@jambotron/aria-grid';

providers: [
  provideJtGridLabels({ selectAll: 'Выбрать все', pageSize: 'Строк на странице', of: 'из' })
]

You only pass the texts you want to change. The rest stay in English.

If the user can switch the language while the app is running, pass a function. The grid reads it on every change detection, so the texts follow the switch. The demo keeps the language in a signal:

export const lang = signal<'en' | 'ru'>('en');

providers: [
  provideJtGridLabels(() => (lang() === 'ru' ? RU_LABELS : {}))
]

Keys: actions, moreActions, selectAll, selectRow, selected, bulkActions, clearSelection, pages, of, pageSize, first, previous, next, last, done, failed, cancel, reason. The type JtGridLabels lists them all. Column titles and action labels are yours: make columns a computed if they must follow the language too.

9.2 Colors: the --jt-* variables

Every color, radius, spacing and duration of the grid is a CSS variable. Their defaults sit on :where(:root), which has zero specificity, so any value your app sets wins. You do not need !important or a more specific selector.

Variable Used for
--jt-accent, --jt-accent-text, --jt-on-accent Active sort arrow, focus outline, hover tint, selected rows
--jt-danger, --jt-danger-text Dangerous menu items
--jt-text, --jt-text-muted, --jt-text-disabled Cells, headers, disabled items
--jt-divider Row lines
--jt-field-bg, --jt-field-border, --jt-focus-ring The page-size picker and jt-select
--jt-popup-bg, --jt-popup-border, --jt-shadow-lg The "⋮" menu and dropdown lists
--jt-glow-accent The glow of the selection bar
--jt-radius-sm, --jt-radius-md, --jt-radius-pill Corners
--jt-space-1 … --jt-space-4 Padding of cells and menu items
--jt-duration-fast, --jt-duration-base, --jt-duration-slow, --jt-easing Animations

The full list with the default values is in styles/aria-grid.scss of the package.

9.3 Three themes in the demo

The demo switches themes with one attribute on <html>: data-theme="jambotron-light", "jambotron-dark" or "synthwave". Each theme is one block of variables:

@use '@angular/material' as mat;
@use '@jambotron/aria-grid/styles/aria-grid';

[data-theme='jambotron-dark'] {
  color-scheme: dark;
  --jt-accent: #3ee6ff;
  --jt-accent-text: #7ff0ff;
  --jt-on-accent: #050a24;
  --jt-text: #eef2ff;
  --jt-text-muted: #ccd4ec;
  --jt-divider: rgba(195, 204, 230, 0.16);
  --jt-popup-bg: rgba(8, 12, 36, 0.95);
  /* … */
}

[data-theme='synthwave'] {
  color-scheme: dark;
  --jt-accent: #00f0ff;
  --jt-danger-text: #ff8fa3;
  --jt-popup-border: rgba(255, 0, 127, 0.45);
  --jt-radius-md: 12px;
  /* … */

  // a theme may also restyle the table itself
  .jt-table th { font-family: Orbitron, sans-serif; color: #00f0ff; }
}

Material (the checkboxes, buttons, dialog and snack bar the grid uses) is themed once and takes its colors from the same variables. Its light or dark palette follows color-scheme, which each theme sets:

html {
  @include mat.theme(
    (color: (primary: mat.$cyan-palette, theme-type: color-scheme), density: 0),
    (primary: var(--jt-accent-text), error: var(--jt-danger-text),
     surface: var(--app-surface), on-surface: var(--jt-text))
  );
  @include mat.checkbox-overrides((
    selected-icon-color: var(--jt-accent),
    selected-checkmark-color: var(--jt-on-accent)
  ));
}

A small service sets the attribute and remembers the choice. A short inline script in index.html sets it before Angular starts, so the page never flashes in the wrong colors. With no saved choice, the demo follows the system setting (prefers-color-scheme).

The values of the Jambotron themes come from the design tokens of jambotron.com. The Synthwave values come from the web client of Synth Mail. The same grid looks native in both apps, and the grid's code did not change for either of them.

9.4 A bonus: jt-select

The page-size picker is a component of its own, and the package exports it. It is an accessible dropdown (Angular Aria combobox and listbox) that uses the same variables. The theme and language switches of the demo are built with it:

<jt-select label="Theme" [options]="themes" [value]="theme()" (valueChange)="$event && theme.set($event)" />
themes: JtSelectOption<Theme>[] = [
  { value: 'jambotron-light', label: 'Jambotron light' },
  { value: 'jambotron-dark', label: 'Jambotron dark' },
  { value: 'synthwave', label: 'Synthwave (reactive-mail-server)' }
];

value is a model(), so [(value)]="selected" works too when the signal's type allows null.


10. Deploying the demo on Jambotron

The demo is a static Angular app. The repository has a two-stage Dockerfile: it builds with node:22-bookworm-slim and serves with nginx:1.27. Unknown paths fall back to index.html, hashed bundles are cached for a year and index.html is never cached. The Compose file has one service:

name: aria-grid-demo

services:
  web:
    build: .
    restart: unless-stopped
    expose:
      - "80"
    mem_limit: 64m

Steps on Jambotron:

  1. Create a project and upload the repository as a ZIP.
  2. In the deploy wizard, pick docker-compose.yml.
  3. Give the web service a domain, port 80.
  4. Deploy. Jambotron builds the image on the VM and issues an HTTPS certificate for the domain.

The build needs nothing private. The demo's .npmrc still points the @jambotron scope to the npm registry of our Gitea, where the package was published first. A new project does not need it: the package is on npm.


11. Limitations

  • Client-side only. The grid sorts and pages the array it receives. For tens of thousands of rows or server-side paging, use a grid built for that.
  • No column resizing, reordering or hiding, and no virtual scrolling.
  • No built-in filter (see 5.3) and no inline editing of cells.
  • Angular 22 and the same major of @angular/aria, @angular/cdk and @angular/material are required.

12. Conclusion

A typical admin table with @jambotron/aria-grid takes a column list, a few cell templates and two handlers. Sorting, paging, selection, bulk and row actions, keyboard support and screen-reader labels work the same way in every table. The look comes entirely from CSS variables. The same component serves the bright glass of jambotron.com and the neon of Synth Mail, and the demo switches between them at runtime.


13. Source code and demo

Live demo

Links

References

  1. Angular Aria overview. https://angular.dev/guide/aria/overview
  2. WAI-ARIA Authoring Practices, Grid pattern. https://www.w3.org/WAI/ARIA/apg/patterns/grid/
  3. Angular Material theming. https://material.angular.dev/guide/theming

Written for version 0.2.0 in November 2026 and checked against 0.4.3 in December 2026.

Back to list