Skip to content

Virtual Scroll Plugin

The virtual-scroll plugin enables virtualized rendering for large option lists. Instead of rendering all options at once, only the visible options (plus a small buffer) are rendered in the DOM, dramatically improving performance for lists with thousands of items.

Usage

When to Use

Option CountRecommendation
< 500Standard rendering is fine
500 - 2,000Virtual scroll recommended
2,000+Virtual scroll strongly recommended
10,000+Virtual scroll required

Configuration

AttributeDescriptionDefault
data-plugin-virtual-scroll-heightHeight of each option row in pixels36
data-plugin-virtual-scroll-bufferNumber of extra rows to render above/below the visible area10

With AJAX and Pagination

Virtual scroll works alongside AJAX pagination for the best performance with remote data:

Behavior

  • The dropdown renders only the options currently visible in the scroll viewport
  • Scrolling dynamically renders and removes option elements
  • Search filtering works as normal — the filtered list is also virtualized
  • Keyboard navigation (arrow keys) works seamlessly with virtualized options

WARNING

When using virtual scroll, all option rows must have a uniform height. Custom templates with variable-height content may cause rendering issues. Set data-plugin-virtual-scroll-height to match your tallest option.

Performance

Benchmarks with 10,000 static options:

MetricWithout Virtual ScrollWith Virtual Scroll
Initial render~800ms~15ms
DOM nodes10,000+~40
Memory usage~45 MB~5 MB
Scroll performanceJankySmooth 60fps

MIT Licensed