react-virtualized is a set of React components for efficiently rendering large lists and tabular data.
Tip
If you're considering adding react-virtualized to a project, take a look at react-window as a possible lighter-weight alternative.
If you like this project there are several ways to support it:
The following wonderful companies and individuals have sponsored react-virtualized:
Begin by installing the library from NPM:
npm install react-virtualizedMost of react-virtualized's styles are functional (e.g. position, size) and are applied directly to DOM elements.
The Table component also ships with a few optional presentational styles; to use them, import the CSS file once (e.g. while bootstrapping your application):
import "react-virtualized/styles.css";The package is marked as side-effect free (other than its CSS), so bundlers will tree-shake any components you don't use.
TypeScript definitions are included within the published dist folder.
Types are exported for each component's props (e.g. ListProps, GridProps, TableProps) along with the parameters passed to renderers (e.g. RowRendererParams, CellRendererParams, TableCellProps).
By default all react-virtualized components are wrapped in memo to avoid re-rendering unless props or state has changed.
This occasionally confuses users when a collection's data changes (eg ['a','b','c'] => ['d','e','f']) but props do not (eg array.length).
The solution to this is to let react-virtualized know that something external has changed. This can be done a couple of different ways.
This shallow comparison will detect changes to any props, even ones a component doesn't use.
This means you can also pass through additional properties that affect cell rendering to ensure changes are detected.
For example, if you're using List to render a list of items that may be re-sorted after initial render- react-virtualized would not normally detect the sort operation because none of the properties it deals with change.
However you can pass through the additional sort property to trigger a re-render.
For example:
<List {...listProps} sortBy={sortBy} />Grid components can be forcefully re-rendered by calling forceUpdate on their ref.
For Table and List, you'll need to call forceUpdateGrid to ensure that the inner Grid is also updated. For MultiGrid, you'll need to call forceUpdateGrids to ensure that the inner Grids are updated.
Documentation and live examples for every component are available at react-virtualized-docs.vercel.app, along with how-to guides for things like sizing components, infinite loading and server rendering.
Note
AutoSizer is no longer part of react-virtualized (as of version 10); it is available as the separate react-virtualized-auto-sizer package.
This HOC decorates a virtualized component and responds to arrow-key events by scrolling one row or column at a time. This provides a snap-to behavior rather than the default browser scrolling behavior.
Note that unlike the other HOCs in react-virtualized, ArrowKeyStepper adds a <div> element around its children in order to attach a key-down event handler.
The appearance of this wrapper element can be customized using the className property.
| Name | Description |
|---|---|
| children | Function responsible for rendering children.
It is passed |
| columnCount | Number of columns in grid; for |
| rowCount | Number of rows in grid. |
| Name | Description |
|---|---|
| className | CSS class name to attach to the wrapper |
| disabled | Disables all scrolling using arrow-keys. |
| isControlled | This component is "controlled"; it will not update |
| mode | Controls behavior of stepper when arrow key direction changes. "cells" means that the index will only increment or decrement by 1; "edges" means that the opposite side of the grid will be incremented. |
| onScrollToChange | Called when arrow key navigation should update the current scroll-to values. |
| scrollToColumn | Default/initial |
| scrollToRow | Default/initial |
Wraps a cell and measures its rendered content. Measurements are stored in a per-cell cache. Cached-content is not be re-measured.
The child must be a DOM element (e.g. <div>) or a component that passes its ref along to one;
otherwise use a function child and pass registerChild as the ref of the element to be measured.
| Name | Description |
|---|---|
| cache | Cache to be shared between |
| children | Either a React element as a child (eg
The function receives a Children that can't be measured (e.g. text, an array or a fragment, without |
| parent | Reference to the parent |
| Name | Description |
|---|---|
| columnIndex | Index of column being measured (within the parent |
| index | Index of row being measured; alias of |
| rowIndex | Index of row being measured (within the parent |
Describes the header and cell contents of a table column.
This component does not render anything itself;
Table reads the props of its children to render headers and cells
(applying defaultColumnProps to each child's props).
Components that render a Column (e.g. const MyColumn = (props) => <Column {...props} />) can be used as Table children too;
their props are read the same way (the wrapper component itself is never rendered).
| Name | Description |
|---|---|
| dataKey | Uniquely identifies the row-data attribute corresponding to this cell (eg this might be "name" in an array of user objects). |
| width | Flex basis (width) for this column;
This value can grow or shrink based on |
| Name | Description |
|---|---|
| aria-label | Optional aria-label value to set on the column header. |
| cellDataGetter | Callback responsible for returning a cell's data, given its The default |
| cellRenderer | Callback responsible for rendering a cell's contents:
The default |
| className | Optional CSS class to apply to the rendered cell container. |
| columnData | Additional data passed to this column's |
| defaultSortDirection | Default sort order when clicked for the first time. |
| disableSort | If sort is enabled for the table at large, disable it for this column. |
| flexGrow | Flex grow style. |
| flexShrink | Flex shrink style. |
| headerClassName | Optional CSS class to apply to this column's header. |
| headerRenderer | Optional callback responsible for rendering a column's header contents:
The default |
| headerStyle | Optional inline style to apply to this column's header. |
| id | Optional id to set on the column header; used for the cells' |
| label | Header label for this column. |
| maxWidth | Maximum width of column; this property will only be used if |
| minWidth | Minimum width of column. |
| style | Optional inline style to apply to the rendered cell container. |
High-order component that auto-calculates column-widths for Grid cells.
| Name | Description |
|---|---|
| children | Function responsible for rendering a virtualized The |
| columnCount | Number of columns in the |
| width | Width of the |
| Name | Description |
|---|---|
| columnMaxWidth | Optional maximum allowed column width. |
| columnMinWidth | Optional minimum allowed column width. |
Renders tabular data with virtualization along the vertical and horizontal axes. Row heights and column widths must be known ahead of time and specified as properties.
Scrolling is done through the imperative handle (ref): see scrollToCell and scrollToPosition.
| Name | Description |
|---|---|
| cellRenderer | Responsible for rendering a cell given an row and column index.
It receives The |
| columnCount | Number of columns in grid. |
| columnWidth | Either a fixed column width (number) or a function that returns the width of a column given its index: |
| rowCount | Number of rows in grid. |
| rowHeight | Either a fixed row height (number) or a function that returns the height of a row given its index: |
| width | Width of Grid; this property determines the number of visible (vs virtualized) columns. |
| Name | Description |
|---|---|
| aria-label | ARIA label for the grid element. |
| aria-readonly | ARIA readonly attribute for the grid element. |
| autoContainerWidth | Set the width of the inner scrollable container to 'auto'. This is useful for single-column Grids to ensure that the column doesn't extend below a vertical scrollbar. |
| cellRangeRenderer | Responsible for rendering a group of cells given their index ranges. This is an advanced property.
It is useful for situations where the Defaults to |
| className | Optional custom CSS class name to attach to root |
| containerProps | Additional props (eg |
| containerRole | ARIA role for the inner cell-container. |
| containerStyle | Optional custom inline style to attach to inner cell-container element. |
| deferredMeasurementCache | If CellMeasurer is used to measure this Grid's children, this should be a pointer to its CellMeasurerCache. A shared CellMeasurerCache reference enables Grid and CellMeasurer to share measurement data. |
| elementRef | Reference to the outer (scrolling) DOM element. |
| estimatedColumnSize | Used to estimate the total width of a |
| estimatedRowSize | Used to estimate the total height of a |
| getScrollbarSize | Returns the size of the browser's scrollbar. Exposed for testing purposes only. Defaults to |
| height | Height of Grid; this property determines the number of visible (vs virtualized) rows.
Required, unless a With a |
| id | Optional custom id to attach to root |
| initialScrollLeft | Horizontal scroll offset to initially render (and scroll to) the |
| initialScrollTop | Vertical scroll offset to initially render (and scroll to) the |
| isScrollingOptOut | Prevents re-rendering of visible cells on scroll end.
(Opts out of the isScrolling param passed to cellRangeRenderer, to avoid the extra render when scroll stops.)
Visible cells are still re-rendered when the |
| noContentRenderer | Optional renderer to be rendered inside the grid when either |
| onScroll | Callback invoked whenever the scroll offset changes within the inner scrollable region:
|
| onScrollbarPresenceChange | Called whenever a horizontal or vertical scrollbar is added or removed:
|
| onSectionRendered | Callback invoked with information about the section of the Grid that was just rendered.
This callback is only invoked when visible rows have changed:
|
| overscanColumnCount | Number of columns to render before/after the visible slice of the grid. This can help reduce flickering during scrolling on certain browsers/devices. Note that this property has performance implications: the higher the value, the more work needs to be done in reaction to each scroll event. Aim to use the lowest value possible that still generally avoids any empty space from appearing during normal scrolling. |
| overscanIndicesGetter | Responsible for calculating the number of cells to overscan before and after a specified range.
By default, cells are overscanned in the direction the user is scrolling.
This function receives Defaults to |
| overscanRowCount | Number of rows to render above/below the visible slice of the grid. This can help reduce flickering during scrolling on certain browsers/devices. Note that this property has performance implications: the higher the value, the more work needs to be done in reaction to each scroll event. The default value (10) is a good starting point; lower it if possible. |
| role | Optional override of ARIA role default. |
| scrollElement | Element that scrolls the The |
| scrollingResetTimeInterval | Wait this amount of time (in milliseconds) after the last scroll event before resetting Grid |
| style | Optional custom inline style to attach to root |
| tabIndex | Optional override of tab index default. |
Higher-order component that manages lazy-loading for "infinite" data. This component decorates a virtual component and just-in-time prefetches rows as a user scrolls. It is intended as a convenience component; fork it if you'd like finer-grained control over data-loading.
| Name | Description |
|---|---|
| children | Function responsible for rendering a virtualized component.
It is passed |
| isRowLoaded | Function responsible for tracking the loaded state of each row. Rows that are currently loading can be treated as loaded to avoid requesting them multiple times. |
| loadMoreRows | Callback to be invoked when more rows must be loaded. The returned Promise should be resolved once row data has finished loading. It will be used to determine when to refresh the list with the newly-loaded data. This callback may be called multiple times in reaction to a single scroll event. |
| Name | Description |
|---|---|
| minimumBatchSize | Minimum number of rows to be loaded at a time. This property can be used to batch requests to reduce HTTP requests. |
| rowCount | Number of rows in list; can be arbitrary high number if actual number is unknown. |
| threshold | Threshold at which to pre-fetch data. A threshold X means that data will start loading when a user scrolls within X rows. |
It is inefficient to create and manage a large list of DOM elements within a scrolling container if only a few of those elements are visible. The primary purpose of this component is to improve performance by only rendering the DOM nodes that a user is able to see based on their current scroll position.
This component renders a virtualized list of elements with either fixed or dynamic heights.
| Name | Description |
|---|---|
| rowCount | Number of rows in list. |
| rowHeight | Either a fixed row height (number) or a function that returns the height of a row given its index: |
| rowRenderer | Responsible for rendering a row given its index.
It receives The |
| width | Width of the list. |
| Name | Description |
|---|---|
| cellRangeRenderer | Responsible for rendering a group of cells given their index ranges. This is an advanced property.
It is useful for situations where the Defaults to |
| containerProps | Additional props (eg |
| containerStyle | Optional custom inline style to attach to inner cell-container element. |
| deferredMeasurementCache | If CellMeasurer is used to measure this Grid's children, this should be a pointer to its CellMeasurerCache. A shared CellMeasurerCache reference enables Grid and CellMeasurer to share measurement data. |
| elementRef | Reference to the outer (scrolling) DOM element. |
| getScrollbarSize | Returns the size of the browser's scrollbar. Exposed for testing purposes only. Defaults to |
| initialScrollTop | Vertical scroll offset to initially render (and scroll to) the |
| isScrollingOptOut | Prevents re-rendering of visible cells on scroll end.
(Opts out of the isScrolling param passed to cellRangeRenderer, to avoid the extra render when scroll stops.)
Visible cells are still re-rendered when the |
| onScrollbarPresenceChange | Called whenever a horizontal or vertical scrollbar is added or removed:
|
| scrollingResetTimeInterval | Wait this amount of time (in milliseconds) after the last scroll event before resetting Grid |
| aria-label | ARIA label for the list element. There is no default label.
(With |
| aria-readonly | ARIA readonly attribute for the list element.
Not set by default (it doesn't apply to |
| containerRole | ARIA role for the inner container of the rows.
Defaults to |
| role | ARIA role for the list element.
With the default |
| className | Optional custom CSS class name to attach to root |
| estimatedRowSize | Used to estimate the total height of a |
| height | Height constraint for list (determines how many actual rows are rendered).
Required, unless a With a |
| id | Optional custom id to attach to root |
| noRowsRenderer | Callback used to render placeholder content when |
| onRowsRendered | Callback invoked with information about the slice of rows that were just rendered:
|
| onScroll | Callback invoked whenever the scroll offset changes within the inner scrollable region:
|
| overscanIndicesGetter | Responsible for calculating the number of rows to overscan before and after a specified range.
By default ( |
| overscanRowCount | Number of rows to render above/below the visible bounds of the list. This can help reduce flickering during scrolling on certain browsers/devices. Note that this property has performance implications: the higher the value, the more work needs to be done in reaction to each scroll event. |
| scrollElement | Element that scrolls the The |
| style | Optional custom inline style to attach to root |
| tabIndex | Optional override of tab index default. |
This component efficiently displays arbitrarily positioned cells using windowing techniques.
Cell position is determined by an injected cellPositioner property.
Windowing is vertical; this component does not support horizontal scrolling.
Rendering occurs in two phases:
- First pass uses estimated cell sizes (provided by the cache) to determine how many cells to measure in a batch.
Batch size is chosen using a fast, naive layout algorithm that stacks images in order until the viewport has been filled.
After measurement is complete (once the render has been committed) this component evaluates positioned cells
in order to determine if another measurement pass is required (eg if actual cell sizes were less than estimated sizes).
All measurements are permanently cached (keyed by
keyMapper) for performance purposes. - Second pass uses the external
cellPositionerto layout cells. At this time the positioner has access to cached size measurements for all cells. The positions it returns are cached by Masonry for fast access later. Phase one is repeated if the user scrolls beyond the current layout's bounds. If the layout is invalidated due to eg a resize, cached positions can be cleared usingrecomputeCellPositions().
Animation constraints: Simple animations are supported (eg translate/slide into place on initial reveal). More complex animations are not (eg flying from one position to another on resize).
Layout constraints: This component supports multi-column layout. The height of each item may vary. The width of each item must not exceed the width of the column it is "in". The left position of all items within a column must align. (Items may not span multiple columns.)
| Name | Description |
|---|---|
| cellCount | Total number of items. |
| cellMeasurerCache | Caches item measurements (typically an instance of |
| cellPositioner | Positions a cell given an index: |
| cellRenderer | Responsible for rendering a cell given an index:
|
| width | Width of the component; this value determines the number of visible items. |
| Name | Description |
|---|---|
| aria-label | Optional ARIA label to attach to root |
| className | Optional custom CSS class name to attach to root |
| height | Height of the component; this value determines the number of visible items.
Required, unless a With a |
| id | Optional custom id to attach to root |
| keyMapper | Maps an index to a unique id to store cached measurement and position info for a cell.
This prevents eg cached measurements from being invalidated when a collection is re-ordered.
Defaults to the identity function ( |
| onCellsRendered | Callback invoked with information about the cells that were most recently rendered.
This callback is only invoked when visible cells have changed:
|
| onScroll | Callback invoked whenever the scroll offset changes within the inner scrollable region:
|
| overscanByPixels | Render this many additional pixels above and below the viewport. This helps reduce flicker when a user scrolls quickly. |
| role | Optional override of ARIA role default. |
| rowDirection | Row direction of items; can be "ltr" or "rtl". |
| scrollElement | Element that scrolls the The |
| scrollingResetTimeInterval | Wait this amount of time (in milliseconds) after the last scroll event before resetting |
| style | Optional custom inline style to attach to root |
| tabIndex | Optional override of tab index default. |
Renders 1, 2, or 4 Grids depending on configuration. A main (body) Grid will always be rendered. Optionally, 1-2 Grids for sticky header rows will also be rendered. If no sticky columns, only 1 sticky header Grid will be rendered. If sticky columns, 2 sticky header Grids will be rendered.
Scrolling is done through the imperative handle (ref): see scrollToCell and scrollToPosition.
| Name | Description |
|---|---|
| cellRenderer | Responsible for rendering a cell given an row and column index.
It receives The |
| columnCount | Number of columns in grid. |
| columnWidth | Either a fixed column width (number) or a function that returns the width of a column given its index: |
| rowCount | Number of rows in grid. |
| rowHeight | Either a fixed row height (number) or a function that returns the height of a row given its index: |
| width | Width of Grid; this property determines the number of visible (vs virtualized) columns. |
| height | Height of the |
| Name | Description |
|---|---|
| aria-label | ARIA label for the grid element. |
| aria-readonly | ARIA readonly attribute for the grid element. |
| autoContainerWidth | Set the width of the inner scrollable container to 'auto'. This is useful for single-column Grids to ensure that the column doesn't extend below a vertical scrollbar. |
| cellRangeRenderer | Responsible for rendering a group of cells given their index ranges. This is an advanced property.
It is useful for situations where the Defaults to |
| className | Optional custom CSS class name to attach to root |
| containerProps | Additional props (eg |
| containerRole | ARIA role for the inner cell-container. |
| containerStyle | Optional custom inline style to attach to inner cell-container element. |
| deferredMeasurementCache | If CellMeasurer is used to measure this Grid's children, this should be a pointer to its CellMeasurerCache. A shared CellMeasurerCache reference enables Grid and CellMeasurer to share measurement data. |
| elementRef | Reference to the outer (scrolling) DOM element. |
| estimatedColumnSize | Used to estimate the total width of a |
| estimatedRowSize | Used to estimate the total height of a |
| getScrollbarSize | Returns the size of the browser's scrollbar. Exposed for testing purposes only. Defaults to |
| id | Optional custom id to attach to root |
| initialScrollLeft | Horizontal scroll offset to initially render (and scroll to) the |
| initialScrollTop | Vertical scroll offset to initially render (and scroll to) the |
| isScrollingOptOut | Prevents re-rendering of visible cells on scroll end.
(Opts out of the isScrolling param passed to cellRangeRenderer, to avoid the extra render when scroll stops.)
Visible cells are still re-rendered when the |
| noContentRenderer | Optional renderer to be rendered inside the grid when either |
| onScroll | Callback invoked whenever the scroll offset changes within the inner scrollable region:
|
| onSectionRendered | Callback invoked with information about the section of the Grid that was just rendered.
This callback is only invoked when visible rows have changed:
|
| overscanColumnCount | Number of columns to render before/after the visible slice of the grid. This can help reduce flickering during scrolling on certain browsers/devices. Note that this property has performance implications: the higher the value, the more work needs to be done in reaction to each scroll event. Aim to use the lowest value possible that still generally avoids any empty space from appearing during normal scrolling. |
| overscanIndicesGetter | Responsible for calculating the number of cells to overscan before and after a specified range.
By default, cells are overscanned in the direction the user is scrolling.
This function receives Defaults to |
| overscanRowCount | Number of rows to render above/below the visible slice of the grid. This can help reduce flickering during scrolling on certain browsers/devices. Note that this property has performance implications: the higher the value, the more work needs to be done in reaction to each scroll event. The default value (10) is a good starting point; lower it if possible. |
| role | Optional override of ARIA role default. |
| scrollingResetTimeInterval | Wait this amount of time (in milliseconds) after the last scroll event before resetting Grid |
| tabIndex | Optional override of tab index default. |
| classNameBottomLeftGrid | Optional custom className to attach to bottom-left |
| classNameBottomRightGrid | Optional custom className to attach to bottom-right |
| classNameTopLeftGrid | Optional custom className to attach to top-left |
| classNameTopRightGrid | Optional custom className to attach to top-right |
| enableFixedColumnScroll | Fixed columns can be actively scrolled (e.g. with a mouse wheel while the cursor is over them). |
| enableFixedRowScroll | Fixed rows can be actively scrolled (e.g. with a mouse wheel while the cursor is over them). |
| fixedColumnCount | Number of fixed columns. |
| fixedRowCount | Number of fixed rows. |
| hideBottomLeftGridScrollbar | Optionally hides the bottom-left |
| hideTopRightGridScrollbar | Optionally hides the top-right |
| onScrollbarPresenceChange | Called whenever a horizontal or vertical scrollbar is added or removed from the bottom-right |
| style | Optional custom inline style to attach to root |
| styleBottomLeftGrid | Optional custom inline style to attach to bottom-left |
| styleBottomRightGrid | Optional custom inline style to attach to bottom-right |
| styleTopLeftGrid | Optional custom inline style to attach to top-left |
| styleTopRightGrid | Optional custom inline style to attach to top-right |
HOC that simplifies the process of synchronizing scrolling between two or more virtualized components.
| Name | Description |
|---|---|
| children | Function responsible for rendering 2 or more virtualized components.
It is passed the current scroll and size values ( |
None
Table component with fixed headers and virtualized rows for improved performance with large data sets. This component expects explicit width, height, and padding parameters.
Columns are described by Column children (or components that render a Column).
Scrolling is done through the imperative handle (ref): see scrollToRow, scrollToCell, and scrollToPosition.
| Name | Description |
|---|---|
| rowCount | Number of rows in table. |
| rowGetter | Callback responsible for returning a data row given an index:
|
| rowHeight | Either a fixed row height (number) or a function that returns the height of a row given its index:
|
| width | Width of the table. |
| Name | Description |
|---|---|
| cellRangeRenderer | Responsible for rendering a group of cells given their index ranges. This is an advanced property.
It is useful for situations where the Defaults to |
| containerProps | Additional props (eg |
| containerRole | ARIA role for the inner cell-container. |
| containerStyle | Optional custom inline style to attach to inner cell-container element. |
| getScrollbarSize | Returns the size of the browser's scrollbar. Exposed for testing purposes only. Defaults to |
| isScrollingOptOut | Prevents re-rendering of visible cells on scroll end.
(Opts out of the isScrolling param passed to cellRangeRenderer, to avoid the extra render when scroll stops.)
Visible cells are still re-rendered when the |
| onScrollbarPresenceChange | Called whenever a horizontal or vertical scrollbar is added or removed:
|
| scrollingResetTimeInterval | Wait this amount of time (in milliseconds) after the last scroll event before resetting Grid |
| aria-label | ARIA label set on the outer |
| aria-labelledby | ARIA labelledby attribute set on the outer |
| children | One or more
|
| className | Optional custom CSS class name to attach to root |
| deferredMeasurementCache | If |
| disableHeader | Do not render the table header (only the rows). |
| estimatedRowSize | Used to estimate the total height of a |
| gridClassName | Optional custom CSS class name to attach to inner |
| gridStyle | Optional inline style to attach to inner |
| headerClassName | Optional CSS class to apply to all column headers. |
| headerHeight | Fixed height of header row. |
| headerRowRenderer | Responsible for rendering the table header row given an array of columns:
This is an advanced property.
It is useful for situations where you require additional hooks into |
| headerStyle | Optional custom inline style to attach to table header columns. |
| height | Fixed/available height for the outer DOM element.
Required, unless a With a |
| id | Optional custom id to attach to root |
| initialScrollTop | Vertical scroll offset to initially render (and scroll to) the |
| noRowsRenderer | Optional renderer to be used in place of table body rows when |
| onColumnClick | Callback invoked when a user clicks on a table column (cell):
|
| onHeaderClick | Callback invoked when a user clicks on (or activates via the ENTER or SPACE key) a table header:
|
| onRowClick | Callback invoked when a user clicks on a table row:
|
| onRowDoubleClick | Callback invoked when a user double-clicks on a table row:
|
| onRowMouseOut | Callback invoked when the mouse leaves a table row:
|
| onRowMouseOver | Callback invoked when a user moves the mouse over a table row:
|
| onRowRightClick | Callback invoked when a user right-clicks on a table row:
|
| onRowsRendered | Callback invoked with information about the slice of rows that were just rendered:
|
| onScroll | Callback invoked whenever the scroll offset changes within the inner scrollable region:
|
| overscanIndicesGetter | Responsible for calculating the number of rows to overscan before and after a specified range (see |
| overscanRowCount | Number of rows to render above/below the visible bounds of the list. This can help reduce flickering during scrolling on certain browsers/devices. |
| rowClassName | Optional CSS class to apply to all table rows (including the header row).
This value may be either a static string or a function with the signature |
| rowRenderer | Responsible for rendering a table row given an array of columns. This is an advanced property.
It is useful for situations where you require additional hooks into |
| rowStyle | Optional custom inline style to attach to table rows (including the header row).
This value may be either a style object or a function with the signature |
| sort | Sort function to be called if a sortable header is clicked:
|
| sortBy | Data is currently sorted by this |
| sortDirection | Data is currently sorted in this direction (if it is sorted at all). |
| scrollElement | Element that scrolls the The |
| style | Optional custom inline style to attach to root |
| tabIndex | Optional override of inner |
Public methods available on an ArrowKeyStepper ref.
| Name | Description |
|---|---|
| setScrollIndexes | Override the local state of the component with new values for |
Public API of a CellMeasurerCache instance.
| Name | Description |
|---|---|
| clear | Reset cached measurements for a specific cell.
This should be called when a cell needs to be re-measured to handle dynamic content
(e.g. replacing a loading indicator with loaded content, or reacting to state changes for stateful cells).
|
| clearAll | Reset cached measurements for all cells.
This should be called when a |
| columnWidth | Returns the derived width of a column (its widest measured cell) or the default width.
Pass this as the |
| getHeight | Returns the (measured or default) height of the specified cell.
|
| getWidth | Returns the (measured or default) width of the specified cell.
|
| has | Returns true if the specified cell has already been measured.
|
| hasFixedHeight | Returns true if cells have a fixed height (and a dynamic, measured width);
see the |
| hasFixedWidth | Returns true if cells have a fixed width (and a dynamic, measured height);
see the |
| rowHeight | Returns the derived height of a row (its tallest measured cell) or the default height.
Pass this as the |
| set | Stores the measured size of the specified cell.
This is called by |
Public (imperative) methods of a Grid (its ref handle).
| Name | Description |
|---|---|
| forceUpdate | Forcefully re-render the |
| getOffsetForCell | Gets offsets for a given cell and alignment (see |
| getTotalRowsHeight | Gets estimated total rows' height. |
| getTotalColumnsWidth | Gets estimated total columns' width. |
| handleScrollEvent | This method handles a scroll event originating from an external scroll control. It's an advanced method and should probably not be used unless you're implementing a custom scroll-bar solution. |
| invalidateCellSizeAfterRender | Invalidate the size of a cell and recompute visible cells after the current render has been committed.
This is a deferred version of |
| measureAllCells | Pre-measure all columns and rows in a |
| recomputeGridSize | Recomputes row heights and column widths after the specified index (both default to 0).
This function should be called if dynamic column or row sizes have changed but nothing else has.
Since |
| scrollToCell | Ensure the specified column and/or row is visible (scrolling if necessary).
This method can be used to safely scroll back to a cell that a user has scrolled away from even if it was previously scrolled to.
The |
| scrollToPosition | Scroll to the specified offset(s); an omitted offset is left unchanged.
Offsets are clamped to the scrollable range.
Calling this method with the current offsets does nothing.
If the |
Imperative API exposed by InfiniteLoader (e.g. via useRef<InfiniteLoaderImperativeAPI>(null)).
| Name | Description |
|---|---|
| resetLoadMoreRowsCache | Reset any cached data about already-loaded rows.
This method should be called if any/all loaded data needs to be refetched (e.g. a filtered list where the search criteria changes).
If |
Public (imperative) methods of a List (its ref handle).
The handle is also passed to rowRenderer as parent (e.g. for CellMeasurer).
| Name | Description |
|---|---|
| forceUpdateGrid | Forcefully re-render the inner |
| getOffsetForRow | Gets the vertical offset ( |
| invalidateCellSizeAfterRender | Invalidate the size of a row (after the current render has been committed); see |
| measureAllRows | Pre-measure all rows in a |
| recomputeRowHeights | Recompute row heights and offsets after the specified index (defaults to 0).
|
| recomputeGridSize | Recompute row heights and offsets after the specified row index (defaults to 0); see |
| scrollToCell | Ensure the specified row is visible (scrolling if necessary); the column index is ignored.
This allows a |
| scrollToPosition | Scroll to the specified vertical offset; |
| scrollToRow | Ensure the row at the specified index is visible (scrolling if necessary).
This method can be used to safely scroll back to a row that a user has scrolled away from even if it was previously scrolled to.
The |
Imperative API of a Masonry (accessed using a ref, eg useRef<MasonryImperativeAPI>(null)).
This is also the parent value passed to cellRenderer (for CellMeasurer).
| Name | Description |
|---|---|
| clearCellPositions | Clears the internal position cache and re-renders.
Cells are positioned again (by the |
| forceUpdate | Forcefully re-renders the |
| invalidateCellSizeAfterRender | Notifies the |
| recomputeCellPositions | Resets the internal position cache, synchronously re-computes the positions of all measured cells
(by calling the |
| recomputeGridSize | Re-renders the |
Public (imperative) methods of a MultiGrid instance.
| Name | Description |
|---|---|
| forceUpdateGrids | Pass-thru that calls |
| invalidateCellSizeAfterRender | Invalidate the size of a cell (after the current render has been committed); see |
| measureAllCells | Pass-thru that calls |
| recomputeGridSize | Pass-thru that calls |
| scrollToCell | Ensure the specified column and/or row is visible (scrolling if necessary); see |
| scrollToPosition | Scroll to the specified offset(s) of the scrollable (bottom-right) section; see |
Public (imperative) methods of a Table instance.
| Name | Description |
|---|---|
| forceUpdateGrid | Forcefully re-render the inner |
| getOffsetForRow | Gets offset for a given row and alignment ( |
| getScrollbarWidth | Gets the scrollbar width used to pad the table-header. |
| invalidateCellSizeAfterRender | Invalidate the size of a row (after the current render has been committed); see |
| measureAllRows | Pre-measure all rows in a |
| recomputeRowHeights | Recompute row heights and offsets after the specified index (defaults to 0).
|
| recomputeGridSize | Recompute row heights and offsets after the specified row index (defaults to 0); see |
| scrollToCell | Ensure the specified row is visible (scrolling if necessary); the column index is ignored.
This allows a |
| scrollToPosition | Scroll to the specified vertical offset; |
| scrollToRow | Ensure the row at the specified index is visible (scrolling if necessary).
This method can be used to safely scroll back to a row that a user has scrolled away from even if it was previously scrolled to.
The |


