createVirtual API
API reference for the createVirtual composable.
Explore these related pages for additional context and usage patterns.
(items: Ref<readonly T[], readonly T[]>, _options?: VirtualOptions) => VirtualContext<T>(items: Ref<readonly T[], readonly T[]>, _options?: VirtualContextOptions) => ContextTrinity<VirtualContext<T>>Creates a virtual scrolling context with dependency injection support.
(namespace?: string) => VirtualContext<T>Returns the current virtual context from dependency injection.
string | number | null | undefinedThe height of the item.
string | number | undefinedThe height of the container.
number | undefinedThe number of extra items to render.
VirtualDirection | undefinedThe direction of the scrolling.
VirtualAnchor | undefinedThe anchor of the scrolling.
boolean | undefinedWhether to smooth the anchor position.
((distance: number) => void | Promise<void>) | undefinedThe callback to call when the start is reached.
((distance: number) => void | Promise<void>) | undefinedThe callback to call when the end is reached.
number | undefinedThe threshold for the start.
number | undefinedThe threshold for the end.
boolean | undefinedWhether to enable momentum scrolling.
boolean | undefinedWhether to enable elastic scrolling.
Ref<HTMLElement | undefined, HTMLElement | undefined>The element that is being virtualized.
ComputedRef<VirtualItem<T>[]>The items that are being virtualized.
Readonly<ShallowRef<number>>The offset of the virtualized items.
Readonly<ShallowRef<number>>The size of the virtualized items.
ShallowRef<VirtualState>The state of the virtualized items.
(index: number, options?: ScrollToOptions) => voidScroll to an item by index.
() => voidThe scroll event handler.
() => voidThe scrollend event handler.
(index: number, height: number) => voidResize an item by index.
() => voidReset the virtualized items.