Free
Pro

Virtual Scroll

Render large fixed-height lists efficiently with Angular CDK virtual scrolling. Only visible rows (plus a small buffer) stay in the DOM — ideal for inboxes, pickers, and admin tables with thousands of rows. Bind [items] from httpResource in the httpResource cookbook.

Pronew@defer

Virtual Scroll — part of Base UI Pro

Unlock it plus 90 pro blocks, widgets & layouts — $99 one-time. Lifetime updates, 14-day money-back guarantee.

Unlock Pro

Basic usage

Set an explicit height on base-virtual-scroll (e.g. class="h-96"), pass [items] and [itemSize], and provide a row template with baseVirtualScrollItem.

5,000 users — only visible rows are rendered.

Item size

itemSize must match the rendered row height in pixels. Mismatch causes jitter or overlap when scrolling.

HTML

<base-virtual-scroll [itemSize]="72" [items]="rows" class="h-80">...</base-virtual-scroll>

TypeScript

TypeScript

import { Component } from '@angular/core';

// Install: npx base-ui-cli add virtual-scroll
// Paths are relative to aliases.components (default: src/app/components)
import { VirtualScrollItemDirective } from './virtual-scroll/virtual-scroll-item.directive';
import { VirtualScrollComponent } from './virtual-scroll/virtual-scroll.component';

@Component({
  selector: 'app-virtual-scroll-example',
  imports: [
    VirtualScrollComponent,
    VirtualScrollItemDirective
  ],
  template: `...`
})
export class VirtualScrollExampleComponent {}

Install

bash

npx base-ui-cli add virtual-scroll

Installation

Run the following command to add this component to your project:

bash

npx base-ui-cli add virtual-scroll

API Reference

For AI agents

Copy a prompt with the registry name, CLI install, and import — or add the Base UI MCP server.

bash

npx -y base-ui-ng-mcp

Base UI provides standalone components. Import the exact elements you want to use into your component.

typescript (Example)

// Install: npx base-ui-cli add virtual-scroll
// Paths are relative to aliases.components (default: src/app/components)
import { VirtualScrollItemDirective } from './virtual-scroll/virtual-scroll-item.directive';
import { VirtualScrollComponent } from './virtual-scroll/virtual-scroll.component';

@Component({
  selector: 'app-your-component',
  imports: [
    VirtualScrollComponent,
    VirtualScrollItemDirective
  ],
  template: `...`
})
export class YourComponent {}

API for virtual-scroll — generated from JSDoc in the library source.

API reference for virtual-scroll
APIMemberTypeDefaultDescription
base-virtual-scrollclassstring''Extra host classes merged via `cn()`. Set an explicit height (e.g. `h-96`) on the host.
base-virtual-scrollitemsT[][]Full list rendered virtually.
base-virtual-scrollitemSizenumber48Fixed row height in pixels — must match the rendered row template height.
base-virtual-scrollminBufferPxnumber200Minimum pixels rendered outside the viewport (CDK buffer).
base-virtual-scrollmaxBufferPxnumber400Maximum pixels rendered outside the viewport (CDK buffer).
[baseVirtualScrollItem]Marks an `ng-template` as the row template for .