Search documentation

Search all pages, headings and text, in the current package or topic or in all documentation.

Getting started

Receive active-virtual and render a first virtual list with useVirtualAxis.

@workspace/active-virtual 2.1.0Status unknowncontent differs from the recorded release 2.1.0baseline ce081dc3

  1. Receive the package#

    active-virtual is an owner: request it on its own with --owners active-virtual, or it comes along with active-grid or active-geo. Ask the maintainer of Foundation for a bundle, then follow Receiving packages:

    Terminal
    node tools/rps/rps-apply.mjs plan --bundle <bundle-folder> --developmentnode tools/rps/rps-apply.mjs apply --bundle <bundle-folder> --expect-plan <digest> --development
  2. Declare, install and verify#

    JSON
    {  "dependencies": {    "@workspace/active-virtual": "workspace:*",    "react": "^19.0.0",    "react-dom": "^19.0.0"  }}
    Terminal
    pnpm installnode tools/rps/rps-apply.mjs verify-install --from <app-folder>
  3. Render a list#

    TSX
    'use client';
    import {useState} from 'react';import {useVirtualAxis} from '@workspace/active-virtual/react';
    export function VirtualList({rows}: {rows: string[]}) {  const [container, setContainer] = useState<HTMLDivElement | null>(null);  const {projection, itemRef} = useVirtualAxis({    count: rows.length,    estimate: 32,    container,  });  return (    <div ref={setContainer} style={{height: 400, overflow: 'auto'}}>      <div style={{height: projection.extent, position: 'relative'}}>        {projection.items.map((item) => (          <div            key={item.identity}            ref={itemRef(item.identity)}            style={{              position: 'absolute',              top: 0,              left: 0,              width: '100%',              transform: `translateY(${item.offset}px)`,            }}          >            {rows[item.position]}          </div>        ))}      </div>    </div>  );}
    • Read projection during render; it is current for this render's inputs.
    • Keep an estimate function stable (module level or useCallback): a new function is a new input.
    • The container is read after commit; null leaves the axis unattached.

    Ten thousand rows of varying heightClient

    0 of 10,000 rows in the DOM

This page as Markdown