diff --git a/docs/config.json b/docs/config.json index e65ba6ad..d9ef673f 100644 --- a/docs/config.json +++ b/docs/config.json @@ -112,6 +112,18 @@ { "label": "react", "children": [ + { + "to": "framework/react/examples/list", + "label": "List" + }, + { + "to": "framework/react/examples/horizontal-list", + "label": "Horizontal List" + }, + { + "to": "framework/react/examples/grid", + "label": "Grid" + }, { "to": "framework/react/examples/fixed", "label": "Fixed" diff --git a/examples/react/grid/index.html b/examples/react/grid/index.html new file mode 100644 index 00000000..e57b08cf --- /dev/null +++ b/examples/react/grid/index.html @@ -0,0 +1,12 @@ + + +
+ + ++ {sizingMode === 'dynamic' && ( + <> + Dynamic mode: Cell sizes are estimated and can vary + based on content. Best for unknown or variable content. + > + )} + {sizingMode === 'fixed' && ( + <> + Fixed mode: All cells have the same dimensions + (35px height, 100px width). Best performance for uniform grids. + > + )} + {sizingMode === 'variable' && ( + <> + Variable mode: Each row/column has pre-computed + dimensions. Use when sizes are known but vary per row/column. + > + )} +
+ ++ Rendering {virtualRows.length * virtualColumns.length} of{' '} + {(rowCount * columnCount).toLocaleString()} cells ( + {virtualRows.length} rows x {virtualColumns.length} columns) +
++ Efficiently render large 2D grids (spreadsheets, data tables, game + boards) by only rendering visible cells. Both rows and columns are + virtualized simultaneously. +
++ Note: Running in development mode. Performance will + improve in production builds. +
+ )} ++ {sizingMode === 'dynamic' && ( + <> + Dynamic mode: Each item's width is measured at render time. + Content width varies and the virtualizer adapts automatically. + > + )} + {sizingMode === 'fixed' && ( + <> + Fixed mode: All items have the same fixed width (100px). + Best performance, use when all items are identical width. + > + )} + {sizingMode === 'variable' && ( + <> + Variable mode: Each item has a known but different width. + Widths are pre-computed, not measured at runtime. + > + )} +
+ ++ Rendering {virtualItems.length} of {count.toLocaleString()} items +
++ Efficiently render large horizontal lists (carousels, timelines, etc.) + by only rendering visible items. Try different sizing modes to see how + they affect behavior. +
++ Note: Running in development mode. Performance will + improve in production builds. +
+ )} ++ {sizingMode === 'dynamic' && ( + <> + Dynamic mode: Each item's height is measured at render time. + Content can vary and the virtualizer adapts automatically. + > + )} + {sizingMode === 'fixed' && ( + <> + Fixed mode: All items have the same fixed height (35px). + Best performance, use when all items are identical height. + > + )} + {sizingMode === 'variable' && ( + <> + Variable mode: Each item has a known but different height. + Heights are pre-computed, not measured at runtime. + > + )} +
+ ++ Rendering {items.length} of {count.toLocaleString()} items +
++ Efficiently render large vertical lists by only rendering visible items. + Try different sizing modes to see how they affect behavior. +
++ Note: Running in development mode. Performance will + improve in production builds. +
+ )} +