$ rezi
Widgets

VirtualList

Efficiently renders large lists by windowing only the visible range.

Efficiently renders large lists by windowing only the visible range.

Usage

ui.virtualList({
  id: "items",
  items: state.items,
  itemHeight: 1,
  renderItem: (item, index, focused) =>
    ui.text(focused ? `> ${item}` : `  ${item}`, {
      key: String(index),
      style: focused ? { bold: true } : {},
    }),
  onSelect: (item) => openItem(item),
})

Props

PropTypeDefaultDescription
idstringrequiredWidget identifier for focus and routing
itemsT[]requiredItems to render
itemHeightnumber | (item, index) => numberrequiredFixed or variable row height
renderItem(item, index, focused) => VNoderequiredRender function for each item
overscannumber3Extra items rendered above/below viewport
keyboardNavigationbooleantrueEnable arrow/page/home/end navigation
wrapAroundbooleanfalseWrap selection from end to start
onScroll(scrollTop, range) => void-Scroll callback with visible range
onSelect(item, index) => void-Selection callback

Behavior

  • Arrow Up/Down navigates items. Page Up/Down and Home/End jump by page or to boundaries.
  • Mouse scroll wheel scrolls the list (3 lines per tick).
  • The onScroll callback fires for both keyboard navigation and mouse wheel input.

Notes

  • Use itemHeight callback for variable-height rows.
  • renderItem receives a focused flag for styling.
  • The range passed to onScroll is [startIndex, endIndex) and includes overscan.

On this page