Thank you for your interest in contributing to React Virtuoso! This guide will help you get started.
- Node.js (LTS version recommended)
- pnpm (this project uses pnpm workspaces)
-
Fork and clone the repository
-
Install dependencies:
pnpm install
-
Build all packages:
pnpm build
This is a pnpm workspaces monorepo with the following structure:
packages/
react-virtuoso/ - Main virtualization library
gurx/ - urx state management (fork/variant)
masonry/ - Masonry layout component
message-list/ - Chat/message list component
tooling/ - Shared build tooling
apps/
virtuoso.dev/ - Starlight/Astro documentation site
examples/ - Ladle stories for testing/development
The react-virtuoso package uses Ladle for interactive development and testing:
cd packages/react-virtuoso
pnpm run ladleThis launches a server where you can browse and interact with examples from the examples/ folder.
- Create a new branch for your feature or fix
- Make your changes in the appropriate package
- Write or update tests as needed
- Ensure all tests pass and linting is clean
Run unit tests across all packages:
pnpm testFor the react-virtuoso package specifically:
cd packages/react-virtuoso
pnpm run testRun tests in watch mode during development:
pnpm run test:watchRun a specific test file or test name:
pnpm vitest <test-file-path>
pnpm vitest -t "<test-name>"Run the Playwright E2E test suite:
pnpm e2eE2E tests run against Ladle examples and are located in packages/react-virtuoso/e2e/.
Before submitting your changes, ensure:
pnpm lintAuto-fix linting issues:
pnpm lint:fixpnpm typecheckpnpm lint:mdAuto-fix markdown issues:
pnpm lint:md:fixRun the complete CI pipeline locally:
pnpm ciThis runs: setup, build, typecheck, lint, lint:md, test, and e2e.
This project uses lefthook for git hooks. Pre-commit hooks automatically run on staged files:
- Markdown linting on
.mdfiles - Code linting with ESLint
- Type checking on affected packages
To skip hooks (use sparingly):
LEFTHOOK=0 git commit -m "WIP: work in progress"This project uses changesets for version management and changelog generation.
When making changes that affect the public API or user-facing behavior:
pnpm changeset-addFollow the prompts to:
- Select which packages are affected
- Choose the version bump type (major, minor, patch)
- Write a description of your changes
The changeset files are committed with your PR and used during release.
Documentation is auto-synced from package source files to the Starlight docs site.
DO NOT EDIT these auto-generated directories:
apps/virtuoso.dev/src/content/docs/react-virtuoso/apps/virtuoso.dev/src/content/docs/masonry/apps/virtuoso.dev/src/content/docs/gurx/apps/virtuoso.dev/src/content/docs/message-list/
Instead, edit the source files in each package:
- react-virtuoso:
packages/react-virtuoso/README.mdorpackages/react-virtuoso/docs/*.md - masonry:
packages/masonry/README.mdorpackages/masonry/docs/*.md - gurx:
packages/gurx/README.mdorpackages/gurx/docs/*.md - message-list:
packages/message-list/README.mdorpackages/message-list/docs/*.md
cd apps/virtuoso.dev
pnpm run devThe site will be available at http://localhost:4321/
- Use TypeScript with strong typing; avoid
any - Prettier: 140 character width, single quotes, no semicolons
- Naming: camelCase for variables/functions, PascalCase for components
- Imports: React first, external libraries, then internal modules
- Functional components with hooks preferred
- Use urx system patterns for state management
- Update documentation if you're changing public APIs
- Add tests for new features or bug fixes
- Ensure all tests pass and linting is clean
- Add a changeset if your changes affect versioning
- Update relevant example files if applicable
- Write a clear PR description explaining:
- What changes you made
- Why you made them
- Any relevant issue numbers
React Virtuoso uses a custom reactive state management system called urx. Key concepts:
- Systems: Stateful data-processing machines composed of streams
- Streams: Can be stateless (signals) or stateful (depots)
- Transformers: Stream transformation utilities
The virtualization logic is split into modular systems in packages/react-virtuoso/src/:
listSystem.ts- Main composition of all feature systemssizeSystem.ts- Item size tracking and managementlistStateSystem.ts- Visible item ranges and scrolling statedomIOSystem.ts- DOM measurements and interactions- Various feature systems for grouped lists, scroll positioning, etc.
- Check existing issues
- Review the documentation
- Ask questions in discussions
By contributing to React Virtuoso, you agree that your contributions will be licensed under its MIT License.