Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

React components for efficiently rendering large lists and tabular data

License

NotificationsYou must be signed in to change notification settings

bvaughn/react-window

Repository files navigation

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:

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 publisheddist folder

Documentation

Documentation for this project is available atreact-window.vercel.app; version 1.x documentation can be found atreact-window-v1.vercel.app.

List

Required props

NameDescription
rowComponent

React component responsible for rendering a row.

This component will receive anindex andstyle prop by default.Additionally it will receive prop values passed torowProps.

ℹ️ The prop types for this component are exported asRowComponentProps

rowCount

Number of items to be rendered in the list.

rowHeight

Row height; the following formats are supported:

  • number of pixels (number)
  • percentage of the grid's current height (string)
  • function that returns the row height (in pixels) given an index andcellProps
  • dynamic row height cache returned by theuseDynamicRowHeight hook

⚠️ 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 containariaAttributes,index, orstyle props.

Optional props

NameDescription
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 cells).This property can be used to render things like overlays or tooltips.

defaultHeight

Default height of list for initial render.This value is important for server rendering.

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.

ℹ️ TheuseListRef anduseListCallbackRef hooks are exported for convenience use in TypeScript projects.

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.

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.

Grid

Required props

NameDescription
cellComponent

React component responsible for rendering a cell.

This component will receive anindex andstyle prop by default.Additionally it will receive prop values passed tocellProps.

ℹ️ The prop types for this component are exported asCellComponentProps

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 containariaAttributes,columnIndex,rowIndex, orstyle 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's current width (string)
  • function that returns the row width (in pixels) given an index andcellProps
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's current height (string)
  • function that returns the row height (in pixels) given an index andcellProps

Optional props

NameDescription
className

CSS class name.

dir

Corresponds to the HTML dir attribute:https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Global_attributes/dir

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.

defaultHeight

Default height of grid for initial render.This value is important for server rendering.

defaultWidth

Default width of grid for initial render.This value is important for server rendering.

gridRef

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.

ℹ️ TheuseGridRef anduseGridCallbackRef hooks are exported for convenience use in TypeScript projects.

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.

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.

About

React components for efficiently rendering large lists and tabular data

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages


[8]ページ先頭

©2009-2025 Movatter.jp