Skip to content
Vertical Jump Designs-uiFront-End Studio
Get Pro

v3.9 is out.

Data display

VirtualList

Free3.8 KB gzipped

A list that renders only the items in view, so tens of thousands of rows scroll smoothly. Items may have any height (they're measured as they render). Built on useVirtualizer and ScrollArea.

Accessibility: WCAG 2.2 AA · No A or AA violations in light or dark mode · Keys: Tab, Arrow keys, Page Up and 1 more · Full report

Import

tsx
import { VirtualList } from "@vjdesigns/vjdesigns-ui";

Importing only VirtualList adds about 3.8 KB of minified, gzipped JavaScript to your app (React not included). The stylesheet is shared by every component and loaded once: 75.1 KB gzipped.

Examples

Basic

Ten thousand rows, but only the ones in view are in the page. Screen readers still hear "item 4,812 of 10,000": each item carries aria-posinset and aria-setsize. The list is keyboard scrollable, and Tab keeps working through items' links and buttons.

Game 1

#1

Game 2

#2

Game 3

#3

Game 4

#4

Game 5

#5

Game 6

#6

Game 7

#7

Game 8

#8

Game 9

#9

Game 10

#10

tsx
import { Flex, Text, VirtualList } from "@vjdesigns/vjdesigns-ui";

const games = Array.from({ length: 10000 }, (_, i) => ({ id: i + 1, label: `Game ${i + 1}` }));

export function Basic() {
  return (
    <VirtualList
      aria-label="Season games"
      items={games}
      getKey={(game) => game.id}
      height="18rem"
      style={{ width: "100%", maxWidth: "22rem" }}
      renderItem={(game) => (
        <Flex justify="between" style={{ padding: "0.75rem 1rem" }}>
          <Text>{game.label}</Text>
          <Text tone="muted">#{game.id}</Text>
        </Flex>
      )}
    />
  );
}

Right to left

The first example again, inside a right-to-left LocaleProvider (Arabic). Layout, spacing and arrow icons mirror, and the components' built-in text is translated. The example's own text stays in English.

Basic

Game 1

#1

Game 2

#2

Game 3

#3

Game 4

#4

Game 5

#5

Game 6

#6

Game 7

#7

Game 8

#8

Game 9

#9

Game 10

#10

tsx
import { LocaleProvider } from "@vjdesigns/vjdesigns-ui";
import ar from "@vjdesigns/vjdesigns-ui/locales/ar";

// Basic is the "Basic" example above.
<LocaleProvider locale="ar" messages={ar}>
  <Basic />
</LocaleProvider>

Usage notes

Accessibility: a real role="list" whose items carry aria-setsize and aria-posinset, so screen readers announce "item 4,812 of 10,000" even though only a few dozen exist in the page. The scroll area is keyboard scrollable, and Tab through items' links and buttons keeps working (new items render as focus scrolls them into view). Browser find-in-page only sees rendered items, so offer search for long lists.

tsx
<VirtualList
  aria-label="All players"
  items={players}
  height="24rem"
  getKey={(p) => p.id}
  renderItem={(p) => <PlayerRow player={p} />}
/>

API reference

VirtualList

New in 1.5.0
VirtualList props
PropTypeDefault
itemsRequired

The items. Only the ones in view (plus overscan) are rendered.

readonly T[]—
renderItemRequired

Renders one item. Its height can vary; it is measured.

(item: T, index: number) => ReactNode—
getKey

Stable key for an item.

(item: T, index: number) => string | numberits index
estimateSize

Estimated item height in px (or a function of the index), used until an item is measured.

number | ((index: number) => number)48
heightRequired

Height of the scrolling area (any CSS length, or px as a number). The list needs a height to virtualize.

CSSProperties["height"]—
overscan

Extra items rendered above and below the view.

number6
gap

Space between items, in px.

number0
emptyState

Shown instead of the list when items is empty.

ReactNode—
aria-label

Accessible name of the list. Also names the scrolling region.

string—
aria-labelledby

Id of a visible element that names the list.

string—
scrollbarSize

Scrollbar thickness.

"sm""md""md"
apiRef

Controls for scrolling to an item.

Ref<VirtualListApi>—
className

Class name for the outer scroll area.

string—
itemClassName

Class name for each item wrapper.

string—
style

Style for the outer scroll area.

CSSProperties—

See what changed in each version in the Changelog.

Accessibility report

VirtualList targets WCAG 2.2 AA. Below: a live axe-core audit of this page's examples, Lighthouse scores for the page in both modes, the accessibility behavior built into the component, and the checks only a person can do.

axe-core audit (live)

Running accessibility audit

Checking the examples above…

Lighthouse audit

Light mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Dark mode

Score 100

35 passed · 0 failed · 30 not applicable · 10 to check by hand

Lighthouse 13.5.0 audits the whole docs page (header and sidebar included), not just the examples, in English. Last run 11/27/2026. Some failed audits carry no weight in the score, so a page can score 100 and still list one.

Built-in behavior

Keyboard

Keyboard
KeyAction
TabMoves into the list, then through items' links and buttons (new items render as focus reaches them).
Arrow keysPage UpPage DownScroll the list.

Only items in view are in the page, so browser find-in-page sees only those; offer a search for long lists.

Roles and states

Roles and states
ElementRoleStates and properties
Listlistaria-label or aria-labelledby
Itemlistitemaria-posinset and aria-setsize, so position is read as "4,812 of 10,000"

Manual checks

Automated tools find roughly a third of accessibility issues. Test these in your app, with your content.

Manual accessibility checks
CheckWhat to testWCAG 2.2
KeyboardEvery action works with Tab, Shift+Tab, Enter, Space and the arrow keys, and focus never gets stuck.2.1.1 (A), 2.1.2 (A)
FocusFocus moves in a logical order, is always visible, and isn't hidden behind sticky headers.2.4.3 (A), 2.4.7 (AA), 2.4.11 (AA), 2.4.13 (AAA)
Screen readersNames, roles and states are announced correctly, and status changes are announced without moving focus.1.3.1 (A), 4.1.2 (A), 4.1.3 (AA)
ColorMeaning never depends on color alone; your own colors meet contrast in both modes.1.4.1 (A), 1.4.3 (AA), 1.4.11 (AA), 1.4.6 (AAA)
Zoom and reflowAt 200% text size and at 320px wide (400% zoom), nothing is cut off and no sideways scrolling is needed.1.4.4 (AA), 1.4.10 (AA), 1.4.12 (AA)
Pointer targetsClick and tap targets are at least 24×24px (44×44px for AAA), or spaced so they don't overlap.2.5.8 (AA), 2.5.5 (AAA)
MotionAnimations respect the reduced-motion setting.2.3.3 (AAA)