← All Components
<mth-virtual-scroller>
Windowed list virtualizer backed by VirtualizerController with prefix-sum variable sizing and dynamic measurement.
When NOT to use: Use a lightweight @methane-ui/css layout class instead of a custom element when static CSS suffices.
Live Interactive Preview
Ready · interact with <mth-virtual-scroller>, or toggle Theme, Direction (LTR/RTL), or props above.
Multi-Framework Playground & Snippets
<script type="module" src="@methane-ui/ui/virtual-scroller"></script>
<mth-virtual-scroller estimate-size="48" overscan="3">Example</mth-virtual-scroller>import '@methane-ui/ui/virtual-scroller';
import '@methane-ui/react';
export function Example() {
return <mth-virtual-scroller estimate-size="48" overscan="3">Example</mth-virtual-scroller>;
}<script setup lang="ts">
import '@methane-ui/ui/virtual-scroller';
</script>
<template>
<mth-virtual-scroller estimate-size="48" overscan="3">Example</mth-virtual-scroller>
</template>import { Component, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import '@methane-ui/ui/virtual-scroller';
import { MthVirtualScrollerDirective } from '@methane-ui/angular';
@Component({
standalone: true,
schemas: [CUSTOM_ELEMENTS_SCHEMA],
imports: [MthVirtualScrollerDirective],
template: `<mth-virtual-scroller estimate-size="48" overscan="3">Example</mth-virtual-scroller>`,
})
export class ExampleComponent {}<script lang="ts">
import '@methane-ui/ui/virtual-scroller';
import MthVirtualScroller from '@methane-ui/svelte/MthVirtualScroller.svelte';
</script>
<MthVirtualScroller estimate-size="48" overscan="3">Example</MthVirtualScroller>Properties & Attributes
| Property | Attribute | Type | Default | Description |
|---|---|---|---|---|
estimateSize | estimate-size | number | 48 | Default estimated block-size per item in pixels. |
overscan | overscan | number | 3 | Number of extra items rendered outside the visible viewport. |
viewportHeight | viewport-height | number | 320 | Fallback viewport height in pixels before resize measurement. |
label | label | string | "" | Optional accessible aria-label on the virtual list region. |
Events
| Event | Detail Type | Description |
|---|---|---|
mth-range-change | { startIndex: number; endIndex: number } | Fired when the visible [startIndex, endIndex] slice changes. |
APG Keyboard Matrix
| Key | Direction | When | Expected Behavior |
|---|---|---|---|
| PageDown | both | Viewport is focused | Scrolls windowed list forward and updates rendered items |
| PageUp | both | Viewport is focused | Scrolls windowed list backward and updates rendered items |
Accessibility Checklist
| Category | Requirement | Verified By |
|---|---|---|
| aria | All aria-* IDREFs resolve within the same DOM root (ADR-003). | scanSameRootAria |
| focus | delegatesFocus: true with zero host internals.role (ADR-014). | lint-plugin & spec-compiler |
| contrast | Renders legible borders, focus outlines, and selection indicators under forced-colors: active. | Playwright forced-colors matrix |
| keyboard | Implements all 2 APG keyboard transitions across LTR/RTL. | mth-virtual-scroller.spec.test.ts |