react-grid-layout
A responsive, draggable, and resizable grid layout system for React with breakpoints and zero jQuery.
Repository Health
Technical Analysis
React Grid Layout is a grid layout system for React that lets users drag, resize, and rearrange widgets on a responsive canvas. It powers dashboards and drag-and-drop editors at companies like Grafana, Metabase, Kibana, and BitMEX, offering breakpoint-aware layouts, bounds checking, and serializable state without any jQuery dependency.
Version 2 is a complete TypeScript rewrite with first-class types, React hooks (useContainerWidth, useGridLayout, useResponsiveLayout), a tree-shakeable modular architecture, and a framework-agnostic core of pure layout algorithms. A legacy entry point preserves 100% runtime compatibility with the widely used v1 flat-props API.
What You Get
- A drop-in
<ReactGridLayout>component that turns child elements into draggable, resizable grid widgets - Responsive breakpoint support with independent layouts per breakpoint and auto-generated fallbacks
- React hooks (useContainerWidth, useGridLayout, useResponsiveLayout) for width measurement and layout state
- A framework-agnostic
/coremodule exposing pure collision, compaction, and positioning algorithms - A
/legacyentry point giving 100% runtime compatibility with the v1 flat-props API for painless migration
Common Use Cases
- Building customizable, user-rearrangeable analytics dashboards
- Creating drag-and-drop page or form builders
- Persisting and restoring per-user widget layouts across sessions and screen sizes
- Composing responsive widget grids that reflow across breakpoints
Under The Hood
Architecture
The library is organized into layered modules under src/: a pure, React-free core/ (collision.ts, compactors.ts, constraints.ts, layout.ts, position.ts, calculate.ts, responsive.ts) that implements collision detection, compaction, and grid-cell math; a react/ layer with the GridLayout, ResponsiveGridLayout, GridItem, and WidthProvider components plus hooks; an extras/ module for optional pieces like GridBackground and fast O(n log n) compactors; and a legacy/ wrapper reproducing the v1 flat-props surface. Grid items are positioned with CSS transforms (or absolute positioning via a pluggable position strategy), and dragging/resizing is delegated to react-draggable and react-resizable.
Tech Stack
Written in TypeScript (57%) with remaining JavaScript, built with tsup into tree-shakeable ESM and CJS bundles with generated .d.ts types. Runtime dependencies are minimal: clsx, fast-equals, prop-types, react-draggable, react-resizable, and resize-observer-polyfill. React >= 16.3 is a peer dependency, with v2 targeting React 18+. Tooling includes Babel, Jest, ESLint (flat config), Prettier, Husky, and webpack for the examples site.
Code Quality
The repository has an extensive Jest test suite under test/spec/ covering compactors, constraints, core functions, hooks, lifecycle, drop alignment, margin consistency, TypeScript component typing, and backward compatibility, plus benchmark tests. Code is strongly typed with a clean separation between pure algorithms and React bindings, and exported surfaces are deliberately curated (some internal helpers are intentionally not exported). This is a mature, well-tested codebase.
API Design
The v2 API groups related props into focused config objects (gridConfig, dragConfig, resizeConfig, positionStrategy, compactor) rather than a flat prop soup, and pairs them with ergonomic hooks so container width and layout state are easy to wire up. Documentation is thorough: a large README with 20+ live demos, a migration guide, an RFC, and a CodeSandbox. The legacy wrapper lowers migration cost significantly. The main tradeoff is that the required width prop and breakpoint concepts impose a modest learning curve for newcomers.
Used by 27 apps in this directory
Laminar
AI Development · Monitoring
Open-source observability platform purpose-built for AI agents — trace, evaluate, debug, and monitor at scale with SQL access and real-time replay.
Langfuse
AI Development · Monitoring
Open source AI engineering platform for LLM observability, prompt management, evaluation, and debugging — self-host in minutes or use Langfuse Cloud.
Lightdash
Analytics · Data Engineering
The open-source Looker alternative that turns your dbt project's metrics and dimensions into governed, self-serve charts and dashboards — no license key required.
marimo
Data Engineering · Developer Tools
A reactive Python notebook that eliminates hidden state, runs reproducibly, and deploys as a web app or script — stored as pure Python, built for the AI era.
Metabase
Analytics
The open-source BI platform that lets anyone ask questions and build dashboards without writing SQL — with an embedded analytics SDK and AI-powered query assistant included.
OpenPanel
Analytics
Open-source Mixpanel alternative with session replay, MCP integration, and privacy-first product analytics you fully control.
PostHog
Ab Testing Experimentation · Analytics · Developer Tools
The all-in-one open source product platform combining analytics, session replay, feature flags, error tracking, AI observability, and a built-in data warehouse in a single self-hostable stack.
Redash
Analytics · Data Engineering
Redash lets anyone connect to 35+ SQL and NoSQL data sources, write a query in the browser, and turn the result into a shared dashboard — no separate BI suite required.
Rybbit
Analytics
Open-source, privacy-friendly web and product analytics with cookieless tracking, session replays, funnels, and real-time dashboards — a self-hostable alternative to Google Analytics.