Components/VirtualList
Universal Component

VirtualList

Virtualized list for long data sets with lower DOM cost.

This page was migrated by AI, please review carefully

Migration is complete, but please validate against source code and manual review.

VirtualList

Virtualized list for long data sets with lower DOM cost.

Basic Usage

Demo will load when visible.
<script setup lang="ts">
const items = Array.from({ length: 100 }, (_, i) => `Item ${i + 1}`)
</script>

<template>
  <TxVirtualList :items="items" :item-height="36" height="240px">
    <template #item="{ item, index }">
      <div style="padding: 6px 12px; width: 100%;">
        {{ index + 1 }}. {{ item }}
      </div>
    </template>
  </TxVirtualList>
</template>

API

TxVirtualList Props

NameTypeDefaultDescription
itemsany[][]Data items
itemHeightnumber-Item height
heightnumber | string320Container height
overscannumber4Pre-render count
itemKeystring | (item, index) => string | numberindexUnique key

Events

EventPayloadDescription
scroll({ scrollTop, startIndex, endIndex })Scroll event

Slots

NameDescription
itemCustom item renderer

Expose

NameDescription
scrollToIndex(index)Scroll to index
scrollToTop()Scroll to top
scrollToBottom()Scroll to bottom