<img src="https://react-window.vercel.app/og.svg" alt="react-window logo" width="400" height="210" />
npm install react-windowreact-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.
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:
Begin by installing the library from NPM:
``sh`
npm install react-window
TypeScript definitions are included within the published dist folder
Frequently asked questions can be found here.
Documentation for this project is available at react-window.vercel.app; version 1.x documentation can be found at react-window-v1.vercel.app.
Renders data with many rows.
#### Required props
| Name | Description |
|---|---|
| rowComponent | React component responsible for rendering a row. This component will receive an ℹ️ The prop types for this component are exported as |
| rowCount | Number of items to be rendered in the list. |
| rowHeight | Row height; the following formats are supported:
⚠️ Dynamic row heights are not as efficient as predetermined sizes. |
| rowProps | Additional props to be passed to the row-rendering component. ⚠️ This object must not contain |
#### Optional props
| Name | Description |
|---|---|
| className | CSS class name. |
| style | Optional CSS properties. |
| children | Additional content to be rendered within the list (above cells). |
| defaultHeight | Default height of list for initial render. |
| listRef | Ref used to interact with this component's imperative API. This API has imperative methods for scrolling and a getter for the outermost DOM element. ℹ️ The |
| onResize | Callback notified when the List's outermost HTMLElement resizes. |
| onRowsRendered | Callback notified when the range of visible rows changes. |
| overscanCount | How many additional rows to render outside of the visible area. |
| tagName | Can be used to override the root HTML element rendered by the List component. ⚠️ In most use cases the default ARIA roles are sufficient and this prop is not needed. |
Renders data with many rows and columns.
ℹ️ Unlike List rows, Grid cell sizes must be known ahead of time.CellProps`) without rendering.
Either static sizes or something that can be derived (from the data in
#### Required props
| Name | Description |
|---|---|
| cellComponent | React component responsible for rendering a cell. This component will receive an ℹ️ The prop types for this component are exported as |
| cellProps | Additional props to be passed to the cell-rendering component. ⚠️ This object must not contain |
| columnCount | Number of columns to be rendered in the grid. |
| columnWidth | Column width; the following formats are supported:
|
| rowCount | Number of rows to be rendered in the grid. |
| rowHeight | Row height; the following formats are supported:
|
#### Optional props
| Name | Description |
|---|---|
| className | CSS class name. |
| dir | Indicates the directionality of grid cells. ℹ️ See HTML |
| style | Optional CSS properties. |
| children | Additional content to be rendered within the grid (above cells). |
| defaultHeight | Default height of grid for initial render. |
| defaultWidth | Default width of grid for initial render. |
| gridRef | Imperative Grid API. ℹ️ The |
| onCellsRendered | Callback notified when the range of rendered cells changes. |
| onResize | Callback notified when the Grid's outermost HTMLElement resizes. |
| overscanCount | How many additional rows/columns to render outside of the visible area. |
| tagName | Can be used to override the root HTML element rendered by the List component. ⚠️ In most use cases the default ARIA roles are sufficient and this prop is not needed. |