Skip to content

Virtual List for Angular

AngularData display

Renders only the visible items (plus an overscan) of very large lists, 100,000 items and more, with fixed or measured variable heights. Selectable lists are WAI-ARIA listboxes with single or multiple selection, type-ahead, and roving focus; otherwise the list is a plain role=list. The focused item always stays rendered. aui-range-change reports the visible range for lazy loading, and an optional loadMore hook adds infinite scroll with a polite status message.

  • 100,000+ itemsOnly the visible items and an overscan are in the DOM; offsets use typed arrays and binary search.
  • Fixed or measured heightsA fixed item height, or measured variable heights that keep the visible content anchored.
  • Listbox selectionSingle or multiple selection with Shift ranges, Ctrl+A, type-ahead, and a roving tab stop.
  • Focus never lostThe focused item stays rendered while you scroll away, so keyboard users keep their place.
  • Lazy and infiniteaui-range-change reports the visible range; loadMore appends pages with a polite status.

Behavior, design tokens, and limitations are described on the Virtual List page; this page covers the Angular API.

import { Component } from '@angular/core';
import { AuiVirtualList } from '@absoluteui/angular/virtual-list';
interface Person { id: string; name: string }
@Component({
selector: 'app-people',
imports: [AuiVirtualList],
template: `<aui-virtual-list label="People" selection="single" [items]="people" [itemKey]="key" [renderItem]="render"></aui-virtual-list>`,
})
export class PeopleComponent {
readonly people: Person[] = Array.from({ length: 10_000 }, (_, i) => ({ id: String(i), name: `Person ${String(i + 1)}` }));
readonly key = (p: Person): string => p.id;
readonly render = (p: Person): Node => document.createTextNode(p.name);
}
Terminal window
npm install @absoluteui/angular @absoluteui/components @absoluteui/core @absoluteui/theme

Setup with provideAbsoluteUI() is covered in Getting started. Styles are included with the component.

import { AuiVirtualList } from '@absoluteui/angular/virtual-list';

Defaults for every instance: provideAbsoluteUIConfig({ components: { virtualList: { ... } } }) (see Configuration).

Class AuiVirtualList; template reference #ref="auiVirtualList".

Server rendering: Renders on the server; the browser re-creates it after hydration.

Input Type Default Description
label string Required. Accessible name of the list.
items readonly Item[] Required. The items (up to 1,000,000; the total height must stay under the browser limit, about 17.9 million px in Firefox); only the visible ones are rendered.
renderItem item: Item, index: number) => Nod Required. Content of one item; called whenever the item is rendered.
itemKey (item: Item, index: number) => string Stable key per item, used by value. Default: the index.
itemText (item: Item, index: number) => string Type-ahead text. Default: strings, numbers, or the item’s label property.
itemHeight number Item height in pixels (the estimate with variableHeight). Default by density: 32, 40, or 48.
variableHeight boolean false Measure every rendered item instead of a fixed height.
height string | null '20rem' Block size of the scroll area as a CSS length, or null to fill the host.
selection VirtualListSelection 'none' none renders a plain list; single and multiple render a listbox.
selectionFollowsFocus boolean false Single selection: moving focus with the keyboard also selects.
isDisabled (item: Item, index: number) => boolean Items that cannot be selected or focused.
empty string | Node Shown instead of the list when there are no items (for example an Empty State host).
loadMore () => void | Promise<void>) | nul Infinite scroll: called near the end; resolve after appending items with update({ items }).
hasMore boolean true More items can be loaded (with loadMore).
loadMoreThreshold number '10' Items from the end at which loading starts.
overscan number '5' Items rendered beyond each edge of the visible area (0 to 100).
locale string 'en-US' Locale of the status messages.
density Density 'comfortable' Default item height when itemHeight is not set.
Model Type Change output Description
[(value)] readonly string[] (valueChange) Keys of the selected items.
Output Payload Description
(changed) VirtualListChangeDetail The user changed the selection: { value, index }. Re-emits aui-change.
(rangeChange) VirtualListRangeChangeDetail The visible range changed: { start, end, renderedStart, renderedEnd } (for lazy loading). Re-emits aui-range-change.

Call them through a viewChild query or a template reference.

Method Description
scrollToIndex(index: number, align?: VirtualListAlign | undefined): void Scroll so the item is visible (auto: only as far as needed).
focusItem(index: number): void Focus an item of a listbox, scrolling it into view.
getItemElement(index: number): HTMLElement | null | undefined The rendered element of an item, or null.
refresh(): void Render the visible items again after item objects changed in place.

Pattern: WAI-ARIA APG Listbox (single and multiple selection, roving focus, type-ahead) when selectable; a plain list (role=list) otherwise. Items carry aria-posinset and aria-setsize because only part of the list is rendered.

The Angular component renders the framework-neutral component, so its keyboard support, roles, WCAG 2.2 criteria, budgets, and import cost apply unchanged: see Virtual List: Accessibility and performance.