Methane@methane-ui/*
CSS LayoutsComponentsSkillsTheme BuilderGitHub
← All Components

<mth-virtual-scroller>

@methane-ui/ui~9.0 KB brotli (cold + Lit)~2.6 KB marginal

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

Interactive StageLive Custom Element · <mth-virtual-scroller> (@methane-ui/ui)
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>

Properties & Attributes

PropertyAttributeTypeDefaultDescription
estimateSizeestimate-sizenumber48Default estimated block-size per item in pixels.
overscanoverscannumber3Number of extra items rendered outside the visible viewport.
viewportHeightviewport-heightnumber320Fallback viewport height in pixels before resize measurement.
labellabelstring""Optional accessible aria-label on the virtual list region.

Events

EventDetail TypeDescription
mth-range-change{ startIndex: number; endIndex: number }Fired when the visible [startIndex, endIndex] slice changes.

APG Keyboard Matrix

KeyDirectionWhenExpected Behavior
PageDownbothViewport is focusedScrolls windowed list forward and updates rendered items
PageUpbothViewport is focusedScrolls windowed list backward and updates rendered items

Accessibility Checklist

CategoryRequirementVerified By
ariaAll aria-* IDREFs resolve within the same DOM root (ADR-003).scanSameRootAria
focusdelegatesFocus: true with zero host internals.role (ADR-014).lint-plugin & spec-compiler
contrastRenders legible borders, focus outlines, and selection indicators under forced-colors: active.Playwright forced-colors matrix
keyboardImplements all 2 APG keyboard transitions across LTR/RTL.mth-virtual-scroller.spec.test.ts