Skip to main content
--- title: Virtual List description: High-performance DOM list and windowing container capable of rendering 10,000+ items smoothly. ---

Virtual List

High-performance windowed rendering primitive for large DOM datasets, infinite scroll lists, and virtualized feeds with zero dependencies.

Live Windowing Demo (5,000 Items)

Only the visible DOM nodes are created and attached to the render tree at any time.

Usage

import { VirtualList } from 'boodoo';

const items = Array.from({ length: 10000 }, (_, i) => `Transaction Item #${i + 1}`);

const vList = new VirtualList('#demoVirtualList', {
  items,
  itemHeight: 48,
  buffer: 5,
  renderItem: (item, index) => {
    const el = document.createElement('div');
    el.className = 'p-3 border-bottom d-flex align-items-center justify-content-between';
    el.innerHTML = `${item}Verified`;
    return el;
  }
});

Options & Methods Reference

Option / Method Type Default Description
items Array<any> [] Array of raw dataset items to render inside the virtual feed.
itemHeight number 48 Fixed height in pixels of each row item container.
buffer number 5 Number of pre-rendered buffer items above and below the visible viewport.
setItems(items) (items: any[]) => void — Replaces dataset items dynamically and updates the window scroll position.
scrollToIndex(idx) (index: number) => void — Instantly scrolls container to bring item at index into view.
dispose() () => void — Detaches scroll/resize listeners and cleans up DOM classes.