+0
日增长
17,215
stars
816
forks
60
watchers
202
prs
727
issues
38
releases
README
react-window is a component library that helps render large lists of data quickly and without the performance problems that often go along with rendering a lot of data. It's used in a lot of places, from React DevTools to the Replay browser.
Support
If you like this project there are several ways to support it:
- Become a GitHub sponsor
- Become an Open Collective sponsor
- or buy me a coffee
The following wonderful companies and individuals have sponsored react-window:
Installation
Begin by installing the library from NPM:
sh
npm install react-window
TypeScript types
TypeScript definitions are included within the published dist folder
FAQs
Frequently asked questions can be found here.
Documentation
Documentation for this project is available at react-window.vercel.app.
Components
Grid
Renders data with many rows and columns.
ℹ️ Unlike List rows, Grid cell sizes must be known ahead of time.
Either static sizes or something that can be derived (from the data in CellProps) without rendering.
Required props
Name
Description
cellComponent
React component responsible for rendering a cell.
This component will receive columnIndex, rowIndex, and style props by default.
Additionally it will receive prop values passed to cellProps.
ℹ️ The prop types for this component are exported as CellComponentProps
cellProps
Additional props to be passed to the cell-rendering component.
Grid will automatically re-render cells when values in this object change.
⚠️ This object must not contain ariaAttributes, columnIndex, rowIndex, or style props.
columnCount
Number of columns to be rendered in the grid.
columnWidth
Column width; the following formats are supported:
number of pixels (number)
percentage of the grid&39;s current width (string)
function that returns the column width (in pixels) given an index and cellProps
ℹ️ Percentage widths can&39;t be resolved during server rendering unless a defaultWidth (or a pixel width via the style prop) is specified.
rowCount
Number of rows to be rendered in the grid.
rowHeight
Row height; the following formats are supported:
number of pixels (number)
percentage of the grid&39;s current height (string)
function that returns the row height (in pixels) given an index and cellProps
ℹ️ Percentage heights can&39;t be resolved during server rendering unless a defaultHeight (or a pixel height via the style prop) is specified.
Optional props
Name
Description
className
CSS class name.
dir
Indicates the directionality of grid cells.
ℹ️ The directionality of an ancestor element can&39;t be detected during server rendering;
specify this prop explicitly for server-rendered right-to-left grids.
ℹ️ See HTMLLatest release
2.5.3 2.5.3 2026-11-01- List identifies rows by ariaAttributes (specifically aria-posinset) so that additional children (e.g. sticky rows or overlays) aren't measured as rows, and rows that render nothing don't shift the indices of the rows after them. Rows that don't spread ariaAttributes, or that override aria-posinset or aria-setsize, are still matched by their position. If only some rows spread ariaAttributes (e.g. loaded rows but not loading placeholders), the rows that don't are not measured; spread ariaAttributes onto every row (or none). - 930, 931