| 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 dir global attribute for more information.
|
| 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 key by default.
This prop can be used along with the rowKey prop to provide a custom key value.
ℹ️ 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 useCallback for this prop; do not use an inline function.
|
| 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 style prop).
|
| 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 display: none,
or uses percentage column widths before its width has been measured), the offset is clamped or ignored and not retried.
Specify a defaultWidth (or a pixel width via the style prop) when using percentage column widths.
|
| 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 display: none,
or uses percentage row heights before its height has been measured), the offset is clamped or ignored and not retried.
Specify a defaultHeight (or a pixel height via the style prop) when using percentage row heights.
|
| 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 style prop).
|
| gridRef | Imperative Grid API.
ℹ️ The useGridRef and useGridCallbackRef hooks are exported for convenience 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.
|
| rowKey | Grids use the row index as a key by default.
This prop can be used along with the columnKey prop to provide a custom key value.
ℹ️ 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 useCallback for this prop; do not use an inline function.
|
| scrollElement | Element that scrolls the grid, for grids that scroll along with other content (e.g. the page):
- "window" to scroll with the page
- an ancestor element that scrolls (e.g. stored with a
useState ref callback); null until it has mounted
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).
- columns scroll with the scroll element too if the grid is as wide as its content (e.g.
style={{ width: "max-content" }});
otherwise the grid fills the width of its parent and its columns scroll within it
scrollToCell, scrollToColumn and scrollToRow scroll whichever element scrolls each axis
defaultHeight and defaultWidth are used as the viewport size until the scroll element has been measured (e.g. during server rendering)
- percentage row heights and column widths are relative to the scroll element's viewport
defaultScrollLeft and defaultScrollTop are ignored
ℹ️ While the scroll element is null, the grid renders the first rows (as it does during server rendering).
⚠️ The grid's onScroll handler is only called when the grid scrolls its own columns;
listen to the scroll element's "scroll" events instead (or use the useIsScrolling hook).
|
| 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.
|