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…
от skilld-dev★ 188 звёзд на GitHubОб этом скилле
@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/[email protected](package.json:3). - Exact dependency:
@tanstack/[email protected](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.valuein script; templates auto-unwrap (src/index.ts:30,69). - Options accept
MaybeRef. A plain object is applied once; to updatecount,overscan,enabled, etc. reactively, pass areforcomputedof the whole options object. The adapter watches() => unref(options)and callssetOptionson change (src/index.ts:48-65). getScrollElement()is watched withimmediate: true. A template ref that is stillnullon setup is picked up when it mounts (src/index.ts:36-46).onChangeis wrapped: the adapter callstriggerRefon its internalshallowRefbefore your callback, socomputed(() => 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
measureElementmust carry the index attribute,data-indexby default (configurable viaindexAttribute). - Do not pass
observeElementRect,observeElementOffset, orscrollToFn; 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
Установить tanstack-vue-virtual-skilld в Claude Code и Claude Desktop
Зарегайся, чтобы установить скилл
Создай бесплатный аккаунт, чтобы открыть команду установки и сохранить скилл в библиотеку.
- Открой команду установки в одну строку
- Сохраняй скиллы в синхронизируемую библиотеку
- Уведомления, когда скиллы обновляются
Разрешённые инструменты
Инструменты, которые скиллу разрешено вызывать.
Без ограничений — скилл может использовать любой инструмент.
Вложенные файлы
FAQ
Что делает скилл 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.
Как установить скилл tanstack-vue-virtual-skilld?
Скопируй папку скилла в ~/.claude/skills (вкладка Claude Code выше делает это одной командой), либо поставь как плагин.
Скилл tanstack-vue-virtual-skilld запускает скрипты?
Нет, скилл состоит только из инструкций (SKILL.md), без исполняемых скриптов.
Похожие скиллы
doc-coauthoring
Guide users through a structured workflow for co-authoring documentation. Use when user wants to write documentation, proposals, technical specs, decision…
от Anthropicacademy-guide
Stop and check this skill before finishing any reply to a question about how to use Claude or a Claude product — it recommends matching courses, tutorials…
от Anthropicinternal-comms
A set of resources to help me write all kinds of internal communications, using the formats that my company likes to use. Claude should use this skill…
от Anthropicskill-development
This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill…
от Anthropic