MCPInstall

tanstack-vue-virtual-skilld

Headless UI for virtualizing scrollable elements in Vue. Use when writing, reviewing, or debugging code that imports @tanstack/vue-virtual, calls useVirtualizer or useWindowVirtualizer, or virtualizes lists, grids, masonry, window-scrolled content, or chat feeds in Vue. Provides version-accurate adapter rules, Virtualizer options and methods, and rendering recipes for @tanstack/vue-virtual 3.13.x on @tanstack/virtual-core 3.17.x.

Installs
128
Last 24h
—
Trending rank
—
Security
Not audited

Install

Works with every agent the skills CLI supports.

npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill tanstack-vue-virtual-skilld
  1. 01

    Install

    Run the command in your project. The CLI asks which agents to install for.

  2. 02

    Describe the task

    Ask your agent for something this skill covers. It loads tanstack-vue-virtual-skilld automatically when relevant.

  3. 03

    Review the result

    The agent follows the SKILL.md steps, scripts and references bundled with the skill.

SKILL.md

The instructions your agent reads when the skill is triggered.

@tanstack/vue-virtual

Headless list/grid virtualization for Vue. The adapter is thin: useVirtualizer and useWindowVirtualizer construct a core Virtualizer, wire it to Vue reactivity, and return it as a Ref. Every option and method below comes from @tanstack/virtual-core, which the adapter re-exports (src/index.ts:21).

Version facts

  • Target: @tanstack/vue-virtual@3.13.39 (package.json:3).
  • Exact dependency: @tanstack/virtual-core@3.17.11 (package.json:52).
  • Peer: vue ^2.7.0 || ^3.0.0 (package.json:59).
  • The adapter API has been stable across 3.13.x; releases 3.13.25 to 3.13.39 only bump virtual-core (vue-virtual changelog).
  • Install: npm install @tanstack/vue-virtual (installation docs).

Quick start: dynamic-height rows

Canonical pattern, following the official Vue dynamic example. Block translation positions the rendered block by the first item's start; each item flows normally inside it.

<script setup lang="ts">
import { computed, onMounted, onUpdated, ref, shallowRef } from 'vue'
import { useVirtualizer } from '@tanstack/vue-virtual'

const parentRef = ref<HTMLElement | null>(null)
const rows = Array.from({ length: 10000 }, (_, i) => `Row ${i}`)

const rowVirtualizer = useVirtualizer({
  count: rows.length,
  getScrollElement: () => parentRef.value,
  estimateSize: () => 55,
  overscan: 5,
})

const virtualRows = computed(() => rowVirtualizer.value.getVirtualItems())
const totalSize = computed(() => rowVirtualizer.value.getTotalSize())

const itemEls = shallowRef<HTMLElement[]>([])
function measureAll() {
  rowVirtualizer.value.measureElement(null) // prune disconnected nodes
  itemEls.value.forEach((el) => el && rowVirtualizer.value.measureElement(el))
}
onMounted(measureAll)
onUpdated(measureAll)
</script>

<template>
  <div ref="parentRef" style="height: 400px; overflow-y: auto; contain: strict">
    <div :style="{ height: `${totalSize}px`, position: 'relative', width: '100%' }">
      <div
        :style="{
          position: 'absolute',
          top: 0,
          left: 0,
          width: '100%',
          transform: `translateY(${virtualRows[0]?.start ?? 0}px)`,
        }"
      >
        <div
          v-for="virtualRow in virtualRows"
          :key="virtualRow.key"
          :data-index="virtualRow.index"
          ref="itemEls"
        >
          {{ rows[virtualRow.index] }}
        </div>
      </div>
    </div>
  </div>
</template>

The scroll container needs a bounded height and overflow: auto. The inner sizer div carries getTotalSize().

Window virtualizer

useWindowVirtualizer scrolls with the browser window; it pre-fills getScrollElement (SSR-safe) and initialOffset, so pass neither (vue-virtual docs, src/index.ts:104-114). When the list sits below other content, measure that offset into scrollMargin:

const parentOffset = ref(0)
onMounted(() => {
  parentOffset.value = parentRef.value?.offsetTop ?? 0
})

const rowVirtualizer = useWindowVirtualizer(
  computed(() => ({
    count: rows.length,
    estimateSize: () => 45,
    scrollMargin: parentOffset.value,
  })),
)

Pattern source: official window example.

Vue adapter rules (proven by src/index.ts)

  • Returns Ref<Virtualizer>, not a raw instance. Use .value in script; templates auto-unwrap (src/index.ts:30,69).
  • Options accept MaybeRef. A plain object is applied once; to update count, overscan, enabled, etc. reactively, pass a ref or computed of the whole options object. The adapter watches () => unref(options) and calls setOptions on change (src/index.ts:48-65).
  • getScrollElement() is watched with immediate: true. A template ref that is still null on setup is picked up when it mounts (src/index.ts:36-46).
  • onChange is wrapped: the adapter calls triggerRef on its internal shallowRef before your callback, so computed(() => rowVirtualizer.value.getVirtualItems()) re-evaluates on scroll and resize (src/index.ts:53-56).
  • Observers are cleaned up via onScopeDispose (src/index.ts:67).
  • Items measured with measureElement must carry the index attribute, data-index by default (configurable via indexAttribute).
  • Do not pass observeElementRect, observeElementOffset, or scrollToFn; the adapter pre-fills them (src/index.ts:83-90).

Details: Vue adapter API.

API reference

Full options table, instance methods, and VirtualItem shape: Virtualizer API.

Required options for useVirtualizer: count, getScrollElement, estimateSize (virtualizer docs).

What is new since virtual-core 3.14.0

vue-virtual 3.13.39 ships core 3.17.11; these arrived via core minors (virtual-core changelog):

  • 3.16.0: end-anchored mode for chat, logs, reverse feeds. anchorTo: 'end', followOnAppend, scrollEndThreshold, plus scrollToEnd(), isAtEnd(), getDistanceFromEnd(). See Chat and end anchoring.
  • 3.15.0: takeSnapshot() for scroll restoration round-trips with initialMeasurementsCache + initialOffset.
  • 3.15.0: default scroll adjustment now skips compensation during backward scroll (fixes "items jump while scrolling up"); override by assigning the instance property shouldAdjustScrollPositionOnItemSizeChange, which is not an option.
  • 3.15.0: iOS Safari momentum-scroll handling, default on; scroll compensation writes are deferred while touching or bouncing.
  • 3.17.0: useCachedMeasurements keeps measurements alive while the list is hidden.
  • Pre-3.15 options still current: lanes with laneAssignmentMode (3.14.0), gap, indexAttribute, initialMeasurementsCache, isRtl.

Best practices

  • Estimate large for dynamic items: set estimateSize near the maximum likely size so initial positions and the scrollbar stay stable (virtualizer docs).
  • Prefer block translation (as in the quick start) over per-item absolute positioning; smooth scrollToIndex skips measuring items far from the target, and block translation keeps the rendered block internally consistent (virtualizer docs).
  • Give a stable getItemKey (row id, not index) whenever data reorders, filters, prepends, or streams; index keys break end-anchored chat and scroll restoration (chat docs).
  • Subtract scrollMargin from item starts when items are positioned absolutely inside a shared scroll container (virtualizer docs).
  • Use the gap option instead of CSS margins so getTotalSize() accounts for spacing.
  • count changes invalidate the measurement cache and update getTotalSize() automatically (fixed in 3.13.13, changelog); in Vue still route reactive data through computed options.
  • Leave useAnimationFrameWithResizeObserver off unless measured to help; it defers measurements by a frame (virtualizer docs).
  • Pause observers with enabled: false instead of unmounting to preserve measurements.

Recipes for masonry, padding, sticky headers, scroll restoration, and hidden lists: Patterns.

Migrating from v2: useVirtual is gone; v3 uses useVirtualizer, the count option (not size), getScrollElement (not parentRef), and measureElement refs with data-index (vue-virtual docs).

References

  • Vue adapter API: signatures, reactivity contract, SSR behavior.
  • Virtualizer API: all options, defaults, instance methods, VirtualItem.
  • Patterns: masonry, scroll margin, sticky ranges, scroll restoration, hidden lists.
  • Chat and end anchoring: anchorTo: 'end' chat feeds in Vue.

FAQ

What does the tanstack-vue-virtual-skilld skill do?

Headless UI for virtualizing scrollable elements in Vue. Use when writing, reviewing, or debugging code that imports @tanstack/vue-virtual, calls useVirtualizer or useWindowVirtualizer, or virtualizes lists, grids, masonry, window-scrolled content, or chat feeds in Vue. Provides version-accurate adapter rules, Virtualizer options and methods, and rendering recipes for @tanstack/vue-virtual 3.13.x on @tanstack/virtual-core 3.17.x.

How do I install tanstack-vue-virtual-skilld?

Run npx skills add https://github.com/skilld-dev/vue-ecosystem-skills --skill tanstack-vue-virtual-skilld in your project. The skills CLI detects the agents you use and copies the skill into the right folder. For Claude Code you can also place the skill folder at ~/.claude/skills/tanstack-vue-virtual-skilld/ (personal) or .claude/skills/tanstack-vue-virtual-skilld/ (project).

Which AI agents can use tanstack-vue-virtual-skilld?

Any agent that supports the open Agent Skills format (a folder with a SKILL.md file), including Claude Code, Codex, Cursor, GitHub Copilot, Gemini CLI, Windsurf, Cline, OpenCode and more.

Is tanstack-vue-virtual-skilld safe to install?

No partner security audit is available yet. Skills can run commands and scripts, so read the SKILL.md and any bundled files before installing.

Who maintains tanstack-vue-virtual-skilld?

It is published by skilld-dev in skilld-dev/vue-ecosystem-skills. It has 128 recorded installs.

More from skilld-dev/vue-ecosystem-skills

View all →

quasar-skilld

skilld-dev/vue-ecosystem-skills

Build, configure, and debug apps with the Quasar framework (quasar npm package, v2.33.1). Use when writing, reviewing, or debugging code that imports "quasar" or "quasar/wrappers", configuring Quasar with Vite, Vitest, Storybook, UMD, or Quasar CLI, styling with Quasar Sass variables, or upgrading between Quasar v2 releases.

Frontend & Design661 installs

vue-i18n-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design401 installs

vue-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design397 installs

vuetify-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design378 installs

pinia-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design313 installs

vue-router-skilld

skilld-dev/vue-ecosystem-skills

Open the skill to read its SKILL.md instructions.

Frontend & Design285 installs

Popular frontend & design skills

View category →

setup-matt-pocock-skills

mattpocock/skills

Configure this repo for the engineering skills: set up its issue tracker, triage label vocabulary, and domain doc layout. Run once before first use of the other engineering skills.

Frontend & Design1.1M installs

frontend-design

anthropics/skills

Guidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults.

OfficialFrontend & Design1M installs

hyperframes-animation

heygen-com/hyperframes

All animation knowledge for HyperFrames — atomic motion rules, multi-phase scene blueprints, scene transitions, broader motion-design techniques, AND the seven runtime adapters (GSAP default, plus Lottie, Three.js, Anime.js, CSS keyframes, Web Animations API, TypeGPU). Use for any motion or animation task: pick 2-4 rules and compose, or load a blueprint, or look up runtime-specific API (e.g. GSAP eases / Lottie player / Three.js mixer). Also covers auditing an existing composition's choreography (animation map) and 24 named text-animation effects. HyperFrames-native: single paused timeline, seek-safe, deterministic.

prototype

mattpocock/skills

Build a throwaway prototype to answer a design question. Use when the user wants to sanity-check whether a state model or logic feels right, or explore what a UI should look like.

Frontend & Design999.2K installs

hyperframes-core

heygen-com/hyperframes

The HyperFrames composition contract — build one renderable project. Use for composition structure, the data- timing attributes, class="clip", tracks, sub-compositions, variables, framework-owned media playback, deterministic-render rules, and validation. Read before writing composition HTML.

Frontend & Design930.5K installs

vercel-react-best-practices

vercel-labs/agent-skills

React and Next.js performance optimization guidelines from Vercel Engineering. This skill should be used when writing, reviewing, or refactoring React/Next.js code to ensure optimal performance patterns. Triggers on tasks involving React components, Next.js pages, data fetching, bundle optimization, or performance improvements.

OfficialFrontend & Design843.1K installs