bvaughn/react-window
bvaughn/react-window — dự án mã nguồn mở — đang có 17.2k sao GitHub. React components for efficiently rendering large lists and tabular data
Tóm tắt dựng từ metadata GitHub của chính dự án — chưa có bài review TopGit. Trang sẽ tự động cập nhật khi bài review đầy đủ được xuất bản.
TopGit viết bài đầy đủ cho repo có nhiều sao nhất và được yêu cầu nhiều nhất. Trang này là snapshot trong thời gian chờ — xem README gốc ở tab READ ME.
Snapshot
Cộng tác viên hàng đầu
Xem cộng tác viên hàng đầu
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:
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 ℹ️ The prop types for this component are exported as |
| 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 |
| columnCount | Number of columns to be rendered in the grid. |
| columnWidth | Column width; the following formats are supported:
ℹ️ Percentage widths can't be resolved during server rendering unless a |
| rowCount | Number of rows to be rendered in the grid. |
| rowHeight | Row height; the following formats are supported:
ℹ️ Percentage heights can't be resolved during server rendering unless a |
Optional props
| Name | Description |
|---|---|
| className | CSS class name. |
| dir | Indicates the directionality of grid cells. ℹ️ The directionality of an ancestor element can't be detected during server rendering; specify this prop explicitly for server-rendered right-to-left grids. ℹ️ See HTML |
| style | Optional CSS properties. The grid of cells will fill the height and width defined by this style. |
| children | Additional content to be rendered within the grid (above cells). This property can be used to render things like overlays or tooltips. |
| columnKey | Grids use the column index as a ℹ️ Custom keys can ensure better UX for sortable or filterable grids, particularly if your cell components are stateful. Refer to the React documentation for more info. ⚠️ This prop cannot be auto-memoized because it is called during render.
It is important to always |
| defaultHeight | Default height of grid (in pixels) for initial render, before its actual height has been measured. ℹ️ Grids can't be measured during server rendering, so this value determines how many rows are server rendered.
It's recommended to set this to the expected height of the grid (or to specify a pixel height via the |
| defaultScrollLeft | Initial horizontal scroll offset (in pixels) of the grid. This value is only applied once, when the grid first mounts with at least one column. ℹ️ Server-rendered HTML can't be pre-scrolled, so server rendering always starts at the first column; the default scroll offset is applied once the grid hydrates. ⚠️ If the grid can't be scrolled that far when the offset is applied (e.g. it is hidden with |
| defaultScrollTop | Initial vertical scroll offset (in pixels) of the grid. This value is only applied once, when the grid first mounts with at least one row. ℹ️ Server-rendered HTML can't be pre-scrolled, so server rendering always starts at the first row; the default scroll offset is applied once the grid hydrates. ⚠️ If the grid can't be scrolled that far when the offset is applied (e.g. it is hidden with |
| defaultWidth | Default width of grid (in pixels) for initial render, before its actual width has been measured. ℹ️ Grids can't be measured during server rendering, so this value determines how many columns are server rendered.
It's recommended to set this to the expected width of the grid (or to specify a pixel width via the |
| 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. This may be used to (re)scroll a cell into view. |
| overscanCount | How many additional rows/columns to render outside of the visible area. This can reduce visual flickering near the edges of a grid when scrolling. |
| rowKey | Grids use the row index as a ℹ️ Custom keys can ensure better UX for sortable or filterable grids, particularly if your cell components are stateful. Refer to the React documentation for more info. ⚠️ This prop cannot be auto-memoized because it is called during render.
It is important to always |
| scrollElement | Element that scrolls the grid, for grids that scroll along with other content (e.g. the page):
The grid renders at its full height and only renders the rows (and columns) visible within the scroll element's viewport. Its position within the scroll element is measured whenever it renders, scrolls, or resizes, and whenever content before it is resized, inserted, or removed (e.g. an image loading above the grid).
ℹ️ While the scroll element is ⚠️ The grid's |
| tagName | Can be used to override the root HTML element rendered by the Grid component. The default value is "div", meaning that Grid renders an HTMLDivElement as its root. ⚠️ In most use cases the default ARIA roles are sufficient and this prop is not needed. |
List
Renders data with many rows.
Required props
| Name | Description |
|---|---|
| rowComponent | React component responsible for rendering a row. This component will receive an ℹ️ Spread ℹ️ 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:
ℹ️ Percentage heights can't be resolved during server rendering unless a ⚠️ Dynamic row heights are not as efficient as predetermined sizes. It's recommended to provide your own height values if they can be determined ahead of time. |
| rowProps | Additional props to be passed to the row-rendering component. List will automatically re-render rows when values in this object change. ⚠️ This object must not contain |
Optional props
| Name | Description |
|---|---|
| className | CSS class name. |
| style | Optional CSS properties. The list of rows will fill the height defined by this style. |
| children | Additional content to be rendered within the list (above rows). This property can be used to render things like overlays or tooltips. |
| defaultHeight | Default height of list (in pixels) for initial render, before its actual height has been measured. ℹ️ Lists can't be measured during server rendering, so this value determines how many rows are server rendered.
It's recommended to set this to the expected height of the list (or to specify a pixel height via the |
| defaultScrollOffset | Initial scroll offset (in pixels) of the list. This value is only applied once, when the list first mounts with at least one row. ℹ️ Server-rendered HTML can't be pre-scrolled, so server rendering always starts at the first row; the default scroll offset is applied once the list hydrates. ⚠️ If the list can't be scrolled that far when the offset is applied (e.g. it is hidden with |
| 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. This may be used to (re)scroll a row into view. |
| onRowsRendered | Callback notified when the range of visible rows changes. |
| overscanCount | How many additional rows to render outside of the visible area. This can reduce visual flickering near the edges of a list when scrolling. |
| rowKey | Lists use the row index as a ℹ️ Custom keys can ensure better UX for sortable or filterable lists, particularly if your row components are stateful. Refer to the React documentation for more info. ⚠️ This prop cannot be auto-memoized because it is called during render.
It is important to always |
| scrollElement | Element that scrolls the list, for lists that scroll along with other content (e.g. the page):
The list renders at its full height and only renders the rows visible within the scroll element's viewport. Its position within the scroll element is measured whenever it renders, scrolls, or resizes, and whenever content before it is resized, inserted, or removed (e.g. an image loading above the list).
ℹ️ While the scroll element is ⚠️ The list itself doesn't scroll, so its |
| tagName | Can be used to override the root HTML element rendered by the List component. The default value is "div", meaning that List renders an HTMLDivElement as its root. ⚠️ In most use cases the default ARIA roles are sufficient and this prop is not needed. |
Hooks
useDynamicRowHeight
Creates a cache of measured row heights for lists whose rows can't be sized ahead of time.
Pass the returned value as the rowHeight prop of List (or the itemSize option of useVirtualizer);
rendered rows are then measured with a ResizeObserver and the list updates as their sizes change.
Rows that have not yet been measured use the defaultRowHeight (or initialRowHeights, if provided).
ℹ️ Dynamic row heights are more expensive than fixed sizes; prefer a number or function when row heights are known.
Parameters
| Name | Description |
|---|---|
| defaultRowHeight | Estimated height (in pixels) of rows that have not yet been measured. |
| initialRowHeights? | Row heights (in pixels) that are known or can be estimated ahead of time, e.g. estimated from each row's content. This can be either an array (where each item is the height of the row at that index) or a Map of row index to height. These values are used in place of ℹ️ This value is only read when the hook first mounts and when the |
| key? | Changing this value clears all measured row heights, e.g. when the list renders a different set of data. |
useGridCallbackRef
Convenience hook to return a properly typed ref callback for the Grid component.
Use this hook when you need to share the ref with another component or hook.
useGridRef
Convenience hook to return a properly typed ref for the Grid component.
useIsScrolling
Tracks whether an element (or the window) is currently scrolling, e.g. to render simplified content in place of rows that are expensive to render.
Pass the element that scrolls:
- a list or grid's own element (e.g. from
useListCallbackRef) - "window" or the scroll element, for lists and grids that use the
scrollElementprop
Scrolling ends when the browser fires a "scrollend" event or,
in browsers that don't support that event, after no scroll events have been received for delay milliseconds.
ℹ️ Scrolling that starts and ends before React renders (e.g. an instant scroll) may not change this value.
⚠️ Changing this value re-renders any rows it is passed to (e.g. via rowProps) when scrolling starts and when it ends.
Parameters
| Name | Description |
|---|---|
| target | |
| delay? | Milliseconds without scroll events after which scrolling is considered to have ended (only used by browsers that don't support the "scrollend" event); defaults to 150. |
useListCallbackRef
Convenience hook to return a properly typed ref callback for the List component.
Use this hook when you need to share the ref with another component or hook.
useListRef
Convenience hook to return a properly typed ref for the List component.
useVirtualizer
Calculates which items to render, and where, for custom (headless) virtualized content
(e.g. a <table> or a custom layout).
The returned items are positioned relative to the start of the element's content; how they are rendered (e.g. absolute positioning or spacer elements) is up to the caller.
Parameters
| Name | Description |
|---|---|
| count | Number of items. |
| defaultScrollOffset? | Initial scroll offset (in pixels), applied once when the element first mounts with at least one item. ℹ️ Ignored when a |
| defaultSize? | Size (in pixels) of the viewport before it has been measured (e.g. during server rendering); this determines how many items are initially rendered. |
| dir? | Direction of horizontal content; detected from the element (or its ancestors) by default. |
| direction? | Direction that items are laid out in; defaults to "vertical". |
| element | Element that scrolls the items or, if a ℹ️ Item offsets are relative to the start of this element's content. |
| itemSize | Item size; the following formats are supported:
ℹ️ Sizes are cached until the value of this option changes;
memoize functions (e.g. with |
| onItemsRendered? | Callback notified when the range of visible (or rendered) items changes. |
| overscanCount? | How many additional items to render outside of the visible area; defaults to 3. |
| scrollElement? | Element that scrolls the items, for items that scroll along with other content (e.g. the page):
See the |
Imperative APIs
GridImperativeAPI
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 useGridRef and useGridCallbackRef hooks are exported for convenience in TypeScript projects.
Methods
| Name | Description |
|---|---|
| scrollToCell | Scrolls the grid so that the specified row and column are visible.
Like the browser's
|
| scrollToColumn | Scrolls the grid so that the specified column is visible.
Like the browser's
|
| scrollToRow | Scrolls the grid so that the specified row is visible.
Like the browser's
|
ListImperativeAPI
Imperative List API.
ℹ️ The useListRef and useListCallbackRef hooks are exported for convenience in TypeScript projects.
Methods
| Name | Description |
|---|---|
| scrollToRow | Scrolls the list so that the specified row is visible.
Like the browser's ℹ️ For dynamic height lists, "smooth" scrolling is animated by the list (rather than the browser) so that the destination can be corrected as rows are measured along the way.
|
Repo liên quan
Master programming by recreating your favorite technologies from scratch.
A curated meta-list of curated lists organized by technology domain. The repository acts as a directory pointing to hundreds of specialized awesome lists covering programming languages, platforms, frameworks, and tooling. All content is community-contributed under the CC0 public domain dedication.
Public APIs is a community-curated GitHub repository listing free, publicly accessible APIs across a wide range of categories, with auth type, HTTPS, and CORS noted for each entry. It's a browsable reference, not a library to install.
REA is an MCP server and CLI that gives AI coding agents the ability to reverse engineer binaries, JavaScript apps, .NET assemblies, and websites. It hooks into Hopper, Ghidra, or IDA Pro for native binary work, or runs static JavaScript analysis with just Node.js. Every investigation returns an Evidence bundle that includes what was found, what was not, and the reasoning path. Setup registers REA with supported agents and walks you through connecting an analysis engine. The CLI also works standalone for terminal-first workflows.
Trả lời nhanh
bvaughn/react-window có bao nhiêu sao?
bvaughn/react-window có 17.2k sao GitHub — tải lại trang để xem số mới nhất, hoặc xem trực tiếp github.com/bvaughn/react-window. TopGit phản chiếu số sao của GitHub nhưng không cam kết đến từng phút.
bvaughn/react-window có phải mã nguồn mở không?
Có — bvaughn/react-window phát hành theo license MIT, nghĩa là mã nguồn mở để đọc, fork và (tùy license) tái sử dụng. Mã: github.com/bvaughn/react-window.
bvaughn/react-window có trang demo không?
Dự án có trang chủ ở https://react-window.vercel.app/. Tab "Readme" ở trang này thường có ảnh chụp và hướng dẫn bắt đầu nhanh.
bvaughn/react-window là gì?
bvaughn/react-window (bvaughn/react-window) là dự án TypeScript trên GitHub. Theo mô tả gốc: React components for efficiently rendering large lists and tabular data
Đọc thêm về bvaughn/react-window ở đâu?
Trang TopGit này là một snapshot — tab "Readme" hiển thị nguyên văn README của repo (đã bỏ link, giữ ảnh). Repo GitHub ở github.com/bvaughn/react-window là nguồn chính thức.
Đọc đầy đủ README ở tab phía trên.
react-window có đáng để bạn bỏ thời gian?
ChatGPT, Claude và Perplexity đều đọc được trang này. Hỏi thử xem họ nghĩ gì về react-window.