Gathering detailed insights and metrics for simple-virtualization
Gathering detailed insights and metrics for simple-virtualization
Gathering detailed insights and metrics for simple-virtualization
Gathering detailed insights and metrics for simple-virtualization
react-render-if-visible
Harness the power of Intersection Observers for simple list virtualization in React
simple-table-core
Simple Table: A lightweight, free React data grid and table component with TypeScript support, sorting, filtering, and virtualization.
@aw-web-design/virtualization
💀🚟 Dead-simple responsive virtualization library
react-virtua
A simple ui library for React
npm install simple-virtualization
Typescript
Module System
Node Version
NPM Version
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
This package provides three powerful virtualization components for React applications:
Virtualization
: A core component for rendering large lists efficientlyVirtualizationTable
: A specialized component for handling large datasets in tabular formatVirtualizationGrid
: A component for efficiently rendering large two-dimensional gridsAll components are designed to optimize performance by rendering only the visible portions of your content.
1npm install simple-virtualization 2# or 3yarn add simple-virtualization
The package includes a comprehensive example application that demonstrates all three virtualization components. The example app showcases various implementation patterns and features:
1npm run example
The example app demonstrates:
1import { Virtualization } from 'simple-virtualization'; 2 3function SimpleList() { 4 const items = Array.from({ length: 10000 }, (_, i) => `Item ${i}`); 5 6 return ( 7 <Virtualization 8 items={items} 9 className="virtual-list" 10 estimatedItemHeight={40} 11 overscanCount={5} 12 /> 13 ); 14}
1import { VirtualizationTable } from 'simple-virtualization'; 2 3function DataTable() { 4 const data = Array.from({ length: 10000 }, (_, i) => ({ 5 id: i, 6 name: `Item ${i}`, 7 value: Math.random() * 100 8 })); 9 10 return ( 11 <VirtualizationTable 12 data={data} 13 Header={({ onSort, sortState }) => ( 14 <div className="header-row"> 15 <div onClick={() => onSort('name')}>Name</div> 16 <div onClick={() => onSort('value')}>Value</div> 17 </div> 18 )} 19 Row={({ item, index }) => ( 20 <> 21 <div>{item.name}</div> 22 <div>{item.value.toFixed(2)}</div> 23 </> 24 )} 25 columnWidths={['200px', '150px']} 26 tableHeight="500px" 27 /> 28 ); 29}
1import { VirtualizationGrid } from 'simple-virtualization'; 2 3function DataGrid() { 4 return ( 5 <VirtualizationGrid 6 dimensions={{ 7 rowCount: 1000, 8 columnCount: 1000 9 }} 10 estimatedColumnWidth={100} 11 estimatedRowHeight={50} 12 overscanCount={2} 13 renderCell={(rowIndex, columnIndex) => ( 14 `Cell ${rowIndex},${columnIndex}` 15 )} 16 className="virtual-grid" 17 style={{ height: '500px' }} 18 /> 19 ); 20}
1interface VirtualizationProps { 2 items: ReactComponentOrElement[]; 3 className?: string; 4 itemClassName?: string; 5 style?: CSSProperties; 6 itemStyle?: CSSProperties; 7 overscanCount?: number; 8 initialRenderCount?: number; 9 estimatedItemHeight?: number; 10}
1interface VirtualizationTableProps<T> { 2 data: T[]; 3 Header: React.ComponentType<{ 4 onSort: (column: string) => void; 5 sortState: SortState; 6 }>; 7 Footer?: React.ComponentType; 8 Row: React.ComponentType<{ item: T; index: number }>; 9 style?: React.CSSProperties; 10 headerStyle?: React.CSSProperties; 11 footerStyle?: React.CSSProperties; 12 rowStyle?: React.CSSProperties; 13 tableHeight?: string | number; 14 estimatedRowHeight?: number; 15 overscanCount?: number; 16 columnWidths?: string[]; 17 footerDistributed?: boolean; 18 defaultSortColumn?: string; 19 defaultSortDirection?: SortDirection; 20}
1interface VirtualizationGridProps { 2 dimensions: { 3 rowCount: number; 4 columnCount: number; 5 }; 6 estimatedColumnWidth?: number; 7 estimatedRowHeight?: number; 8 overscanCount?: number; 9 renderCell: (rowIndex: number, columnIndex: number) => React.ReactNode; 10 className?: string; 11 style?: CSSProperties; 12 cellClassName?: string; 13 cellStyle?: CSSProperties; 14}
Both list and table components automatically measure and adapt to varying content heights:
1<Virtualization 2 items={items} 3 estimatedItemHeight={50} // Initial estimate 4 // Heights are automatically measured and cached 5/>
1<VirtualizationGrid 2 dimensions={{ rowCount: 100, columnCount: 100 }} 3 cellStyle={{ 4 border: '1px solid #ccc', 5 padding: '8px' 6 }} 7 renderCell={(row, col) => ( 8 <div className="custom-cell"> 9 {/* Custom cell content */} 10 </div> 11 )} 12/>
1<VirtualizationTable 2 defaultSortColumn="name" 3 defaultSortDirection="asc" 4 columnWidths={['200px', '150px', '100px']} 5 // Columns will resize proportionally when container width changes 6/>
Supports all modern browsers with these features:
All components include comprehensive TypeScript definitions:
1// Example type usage 2type YourDataType = { 3 id: number; 4 name: string; 5 // ... 6}; 7 8<VirtualizationTable<YourDataType> 9 data={yourData} 10 // TypeScript will ensure type safety 11/>
Contributions are welcome! Please follow these steps:
MIT License
For issues and feature requests, please use the GitHub issue tracker.
No vulnerabilities found.
No security vulnerabilities found.