🚀 Socket Launch Week 🚀 Day 5: Introducing Socket Fix.Learn More

@tanstack/vue-virtual

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install
v

@tanstack/vue-virtual

Headless UI for virtualizing scrollable elements in Vue

3.11.3
Version published
Maintainers
2
Created
Issues
69

What is @tanstack/vue-virtual?

@tanstack/vue-virtual is a Vue.js package that provides utilities for efficiently rendering large lists and grids by virtualizing the DOM. This means it only renders the visible items in the viewport, which can significantly improve performance for applications dealing with large datasets.

What are @tanstack/vue-virtual's main functionalities?

Virtualized List

This feature allows you to create a virtualized list where only the items visible in the viewport are rendered. This can greatly improve performance when dealing with large lists.


<template>
  <VirtualList :items="items" :itemSize="50">
    <template #default="{ item, index }">
      <div :key="index" class="item">
        {{ item }}
      </div>
    </template>
  </VirtualList>
</template>

<script>
import { VirtualList } from '@tanstack/vue-virtual';

export default {
  components: { VirtualList },
  data() {
    return {
      items: Array.from({ length: 10000 }, (_, i) => `Item ${i}`)
    };
  }
};
</script>

Virtualized Grid

This feature allows you to create a virtualized grid where only the cells visible in the viewport are rendered. This is useful for applications that need to display large grids of data.


<template>
  <VirtualGrid :items="items" :columnCount="3" :rowHeight="100" :columnWidth="100">
    <template #default="{ item, rowIndex, columnIndex }">
      <div :key="`${rowIndex}-${columnIndex}`" class="grid-item">
        {{ item }}
      </div>
    </template>
  </VirtualGrid>
</template>

<script>
import { VirtualGrid } from '@tanstack/vue-virtual';

export default {
  components: { VirtualGrid },
  data() {
    return {
      items: Array.from({ length: 10000 }, (_, i) => `Item ${i}`)
    };
  }
};
</script>

Other packages similar to @tanstack/vue-virtual

FAQs

Package last updated on 27 Jan 2025

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts