npm / react-grid-layout
react-grid-layout
What changed in react-grid-layout 1 to 2, from its official release notes, upgrade guides and advisories. Sources checked 2026-10-18.
9 breaking13 new APIs and options1 performance1 tooling4 fixes and other
See which of these apply to your code, ranked, in your agent:
npx @unstale/cli initreact-grid-layout 226 changes
Breaking changes 9
The v2 API requires an explicit layout prop; the data-grid pattern is available only through the legacy wrapper.
Callback parameters are now read-only, so mutations in onResize or onDrag no longer work.
The callback now fires after 3px of mouse movement instead of on mousedown; use onMouseDown on grid items for immediate response.
Callback parameters are now read-only, so mutations in onResize or onDrag no longer work.
React 18 is required; React 16 and 17 support is available only through the legacy wrapper.
The UMD bundle is removed; use a bundler such as Vite, webpack, or esbuild.
Adds reactive container width measurement with ResizeObserver for supplying the required grid width.
The prop is removed; use compactType={null} or compactor={noCompactor} instead.
The grid now requires an explicit width prop and no longer measures its width automatically; use useContainerWidth or the legacy wrapper.
New APIs and options 13
Adds a utility for building custom grid overlays.
Adds a pluggable interface for custom compaction algorithms; the default algorithm remains the same as v1.
Adds a focused configuration prop for grouping related drag settings.
An optional O(n log n) fast compactor is available for large layouts of 200 or more items.
Adds an optional component for visualizing the grid structure.
Adds a focused configuration prop for grouping related grid settings.
Adds an interface for controlling CSS positioning.
Adds a framework-agnostic entry point for core utilities that does not require React.
Adds an optional entry point for extras including GridBackground and fastVerticalCompactor.
Provides the v1 API with backwards compatibility, including support for the legacy width and data-grid patterns.
Adds a focused configuration prop for grouping related resize settings.
Adds core layout state management for custom implementations.
Adds responsive breakpoint management through a hook.
Tooling 1
Adds first-class TypeScript types, so @types/react-grid-layout is no longer needed.
Fixes and other changes 3
Fixes an operator precedence bug that incorrectly made shouldDrag true when only the top position changed.
Fixes resize position calculation when node is falsy.
The library now works with React 18 automatic batching without flushSync warnings.
react-grid-layout 12 changes
Performance 1
The bottom calculation is cached to improve compaction performance.
Fixes and other changes 1
Collision detection now uses the correct y-coordinates, avoiding incorrect collision results.