![Oracle Drags Its Feet in the JavaScript Trademark Dispute](https://cdn.sanity.io/images/cgdhsj6q/production/919c3b22c24f93884c548d60cbb338e819ff2435-1024x1024.webp?w=400&fit=max&auto=format)
Security News
Oracle Drags Its Feet in the JavaScript Trademark Dispute
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
@tanstack/virtual-core
Advanced tools
Headless UI for virtualizing scrollable elements in TS/JS + Frameworks
The @tanstack/virtual-core package is a headless utility for creating virtualized lists, grids, or any other scrolling content. It provides the core logic needed to implement virtualization in web applications, helping to improve performance by only rendering items that are currently visible in the viewport. This package is framework-agnostic, meaning it can be used with any web framework or no framework at all.
List Virtualization
This feature allows for the virtualization of a simple list. By providing the total count of items, a function to get the scrolling element, an estimated size for each item, and an overscan value, the Virtualizer instance can manage which items should be rendered based on the scroll position.
{"import { Virtualizer } from '@tanstack/virtual-core';\n\nconst virtualizer = new Virtualizer({\n count: 1000, // Total number of items\n getScrollElement: () => document.getElementById('scroll-container'), // Element to track scroll\n estimateSize: () => 35, // Estimated size of each item\n overscan: 5, // Number of items to render outside of the viewport\n});\n\nvirtualizer.listen((state) => {\n // Render logic based on the current state\n});"}
Grid Virtualization
This feature supports the virtualization of grid layouts. It extends the list virtualization by adding support for both horizontal and vertical scrolling, making it suitable for large grid layouts where items are arranged in rows and columns.
{"import { Virtualizer } from '@tanstack/virtual-core';\n\nconst virtualizer = new Virtualizer({\n count: 10000, // Total number of items in the grid\n getScrollElement: () => document.getElementById('grid-container'),\n estimateSize: () => ({ width: 100, height: 100 }), // Estimated size of each grid item\n overscan: 5,\n direction: 'both' // Indicates both horizontal and vertical scrolling\n});\n\nvirtualizer.listen((state) => {\n // Render logic for grid items based on the current state\n});"}
React-window is a popular React-specific library for virtualizing long lists and grids. It provides components like FixedSizeList and VariableSizeList for lists, and FixedSizeGrid and VariableSizeGrid for grids. Compared to @tanstack/virtual-core, react-window is more out-of-the-box for React applications but less flexible for non-React or custom implementations.
React-virtualized is another React-focused library offering a wide range of components for virtualization, including lists, tables, grids, and more. It offers more features and flexibility than react-window but at the cost of a larger bundle size. Unlike @tanstack/virtual-core, react-virtualized is not framework-agnostic and is designed specifically for React applications.
FAQs
Headless UI for virtualizing scrollable elements in TS/JS + Frameworks
The npm package @tanstack/virtual-core receives a total of 0 weekly downloads. As such, @tanstack/virtual-core popularity was classified as not popular.
We found that @tanstack/virtual-core demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.
Security News
Maven Central now validates Sigstore signatures, making it easier for developers to verify the provenance of Java packages.