CLAUDE.md · react-grid-layout/react-grid-layout
CLAUDE.md from react-grid-layout/react-grid-layout: 345 lines covering Project Overview, Package Manager, Development Commands, Architecture (v2) and more.
Template by react-grid-layout
Install
Works with Claude Code. Read the repository before you give any tool access to your data.
curl -fsSL https://raw.githubusercontent.com/react-grid-layout/react-grid-layout/master/CLAUDE.md -o CLAUDE.md
Read it and adapt it to your project before use.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Use cases: prompt-engineering
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
What's in it
A CLAUDE.md file: project memory Claude Code loads at the start of every session.
- For
- Claude Code
- Length
- 345 lines
- File
CLAUDE.md
Sections
- Project Overview
- Package Manager
- Development Commands
- Architecture (v2)
- Technology Stack
- Examples
- Testing Guidelines
- Important Implementation Notes
- Build Output
- Bug Reporting
- Custom Skills
- RFC & Design Document
First lines (shown under the repo's MIT license)
# CLAUDE.md
This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
## Project Overview
React-Grid-Layout is a draggable and resizable grid layout system for React with responsive breakpoints. It's a pure React implementation (no jQuery) used in production by BitMEX, Grafana, Metabase, HubSpot, and many others.
**Version 2** is a complete TypeScript rewrite with a modern hooks-based API while maintaining backwards compatibility through a dedicated legacy wrapper.
## Package Manager
**Always use `yarn`** instead of `npm` for all commands in this project. It is Yarn 4, pinned in `package.json` and run through Corepack: run `corepack enable` once, then `yarn install`.
## Development Commands
### Testing
```bash
# Run all tests with coverage
make test
yarn test
# Watch mode for development
make test-watch
# Run specific test file
NODE_ENV=test npx jest --testPathPatterns="compactors"
```
### Building
```bash
# Build the library (ESM, CJS, and TypeScript declarations)
make build
yarn build
# Clean build artifacts
make clean
```
### Development Server
```bash
# Start development server with hot reload (port 4002)
make dev
yarn dev
```
### Linting & Formatting
```bash
# Run ESLint
yarn lint
# Format code with Prettier (run before committing!)
yarn fmt
```
**Important**: Always run `yarn fmt` before committing. The CI will fail if code is not formatted.
### Releasing
```bash
# Patch release (bug fixes) - bumps version, builds, publishes to npm
make release-patch
# Minor release (new features, backwards compatible)
make release-minor
# Major release (breaking changes)
make release-major
```
**Important**: Always use `make release-*` commands, never `npm version` directly. The Makefile handles building, version bumping, and publishing correctly.
## Architecture (v2)
The module structure, public API surface, and data models are documented in the generated maps in `codemaps/` (loaded at session start). Key notes not captured there:
- `src/core/` is pure TypeScript with no React dependencies
- `src/legacy/` is the v1 API compatibility layer, wrapping the v2 components
- `src/extras/` holds optional compactors (fast, wrap) and GridBackground
### Entry Points
```typescript
// New v2 API (recommended)
import ReactGridLayout, {
Responsive,
useContainerWidth,
verticalCompactor,
horizontalCompactor
} from "react-grid-layout";
// With composable interfaces
<ReactGridLayout
width={width}
layout={layout}
gridConfig={{ cols: 12, rowHeight: 30 }}
dragConfig={{ enabled: true, handle: '.handle' }}
resizeConfig={{ enabled: true, handles: ['se'] }}
compactor={verticalCompactor}
/>
// Core utilities (framework-agnostic)
import {
moveElement,
collides,
transformStrategy,
absoluteStrategy,
createScaledStrategy,
getCompactor,
verticalCompactor,
horizontalCompactor
} from "react-grid-layout/core";
// Note: compact() is not exported. Use compactor.compact() instead.
// Legacy v1 API (100% backwards compatible, flat props)
import ReactGridLayout, {
WidthProvider,
Responsive
} from "react-grid-layout/legacy";
```
### Core Components
**GridLayout** (`src/react/components/GridLayout.tsx`)
- Main grid layout component (functional, hooks-based)
- Manages layout state, drag/drop, and resize operations
- Handles compaction (vertical, horizontal, or none)
- All grid items must have a unique `key` prop matching `i` in layout
**ResponsiveGridLayout** (`src/react/components/ResponsiveGridLayout.tsx`)
- Wraps GridLayout with responsive breakpoint support
- Manages multiple layouts keyed by breakpoint
- Automatically generates missing breakpoint layouts
**GridItem** (`src/react/components/GridItem.tsx`)
- Individual grid item wrapper
- Integrates with react-draggable and react-resizable
- Handles positioning via CSS transforms (default)
### Core Algorithms
**Compaction** (`src/core/compactors.ts`)
- `verticalCompactor`: Items float up (default)
- `horizontalCompactor`: Items float left
- `noCompactor`: Free positioning
- All implement the `Compactor` interface
**Collision Detection** (`src/core/collision.ts`)
- `collides()`: Check if two items overlap
- `getFirstCollision()`: Find first collision
- `getAllCollisions()`: Find all collisionsSignals
- Stars
- 22,471
- Forks
- 2,700
- Open issues
- 22
- Last commit (this folder)
- Oct 5, 2026 (23 days ago)
- Last release
- Oct 5, 2026 (23 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- MIT
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from react-grid-layout
Cite this page
CLAUDE.md · react-grid-layout/react-grid-layout. Agent Mart. https://agentmart.dev/templates/react-grid-layout-react-grid-layout-claude-md (last updated 2026-10-24)