An open API service indexing awesome lists of open source software.

https://github.com/mblode/dnd-grid

A draggable and resizable grid layout for React.
https://github.com/mblode/dnd-grid

Last synced: 4 months ago
JSON representation

A draggable and resizable grid layout for React.

Awesome Lists containing this project

README

          



dnd-grid – A drag-and-drop, resizable grid layout for React


npm version
MIT Licence

- **Drag + resize:** smooth interactions with weighted drag physics and configurable handles.
- **Responsive layouts:** breakpoint helpers and automatic container width measurement.
- **Compaction + constraints:** packing strategies, collision handling, and bounds control.
- **Edge auto-scroll:** keep dragging near scroll boundaries.
- **Touch-friendly:** configurable touch drag delay.
- **Styling defaults + hooks:** `base.css`/`theme.css`, CSS variables, data attributes, and item state hook.
- **Accessible grid:** grid semantics plus configurable aria-live announcements.
- **Headless core engine:** `@dnd-grid/core` handles layout math with a React adapter on top.
- **Layout persistence:** add/remove widgets and serialize/restore layouts.

## Documentation

To learn how to get started with **dnd-grid**, visit the official documentation website for API docs, guides, and examples.



Visit dnd-grid documentation

## Demo

Try the live demo.



View dnd-grid demo

## Installation

```bash
npm install @dnd-grid/react
```

Add the styles to your global CSS:

```css
@import "@dnd-grid/react/styles.css";
```

## Usage

```tsx
import { DndGrid, type Layout } from "@dnd-grid/react";

{layout.map((item) => (

{item.id}

))}
;
```

## Acknowledgements

Based on [react-grid-layout](https://github.com/react-grid-layout/react-grid-layout) by Samuel Reed (STRML). Differences: weighted drag physics, better styling defaults (`base.css`/`theme.css`, CSS vars, data attributes), touch drag delay, edge auto-scroll, item state hook.

## Licence

[MIT](LICENSE.md)