Content can wrap across lines without an application-owned height calculator.
Changes before the viewport preserve the item currently being read.
@sectile/virtual lays out large surfaces whose item sizes and order keep changing. Once an element renders, its browser size updates coordinates from the changed point onward. Inserts, removals, and moves before the viewport also preserve the screen position of the item currently being read.
The command follows the Usage environment selected in the top navigation.
pnpm add vue @sectile/vue @sectile/virtualThis list contains 50,000 rows with different heights. Sectile creates only the rows around the viewport and automatically applies their actual DOM sizes. The code tab shows only the implementation for the selected Usage environment.
Content can wrap across lines without an application-owned height calculator.
Changes before the viewport preserve the item currently being read.
Changes before the viewport preserve the item currently being read.
Measured content updates the position of every item that follows it.
Content can wrap across lines without an application-owned height calculator.
Measured content updates the position of every item that follows it.
Content can wrap across lines without an application-owned height calculator.
Changes before the viewport preserve the item currently being read.
<script setup lang="ts">
import { VirtualList } from '@sectile/vue/virtual/list'
const rows = Array.from({ length: 50_000 }, (_, index) => ({
id: `row-${index}`,
title: `Row ${index + 1}`,
lines: Array.from(
{ length: 1 + (index % 3) },
() => 'Content determines this row height.',
),
}))
</script>
<template>
<VirtualList
:items="rows"
:get-key="row => row.id"
>
<template v-slot="{ value: row }">
<article>
<h3>{{ row.title }}</h3>
<p v-for="(line, lineIndex) in row.lines" :key="lineIndex">
{{ line }}
</p>
</article>
</template>
</VirtualList>
</template>| Surface | Layout | Read more |
|---|---|---|
| One ordered axis | Linear | Linear lists |
| Many rows and many columns | Track grid | Grid, masonry, and spatial |
| Variable-height cards | Masonry | Grid, masonry, and spatial |
| Application-positioned canvas | Spatial | Grid, masonry, and spatial |
createVirtualizer.VirtualList, VirtualGrid, VirtualMasonry, and VirtualSpatial.