# dnd-core

> Drag and drop sans the GUI

Latest version **16.0.1** (published 2022-04-19) · MIT license · 0 weekly downloads

## Install

```sh
npm install dnd-core
pnpm add dnd-core
yarn add dnd-core
bun add dnd-core
```

## Health

**Score 30/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; popular repo.

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 16.0.1 |
| Published | 2022-04-19 |
| First published | 2015-03-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 189.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 21629 |
| Maintainers | jordangens, gaearon, darthtrevino, nirice, sant0shg |

## Links

- npm: https://www.npmjs.com/package/dnd-core
- Repository: https://github.com/react-dnd/react-dnd
- npm.io page: https://npm.io/package/dnd-core

## Dependencies (3)

- [redux](https://npm.io/package/redux.md) ^4.2.0
- [@react-dnd/asap](https://npm.io/package/@react-dnd/asap.md) ^5.0.1
- [@react-dnd/invariant](https://npm.io/package/@react-dnd/invariant.md) ^4.0.1

## Recent versions

- 16.0.1 (latest) — 2022-04-19
- 3.0.0 (beta) — 2018-05-02
- 16.0.0 — 2022-04-05
- 15.1.2 — 2022-03-31
- 15.1.1 — 2022-02-07
- 15.1.0 — 2022-02-05
- 15.0.2 — 2022-02-04
- 15.0.1 — 2022-02-04
- 15.0.0 — 2022-02-04
- 14.0.1 — 2021-09-27
- 14.0.0 — 2021-03-09
- 12.0.1 — 2021-02-22
- 12.0.0 — 2021-02-21
- 11.1.3 — 2020-05-29
- 11.1.1 — 2020-05-26
- … 78 more at https://npm.io/package/dnd-core/versions

## README

[![npm package](https://img.shields.io/npm/v/dnd-core.svg?style=flat-square)](https://www.npmjs.org/package/dnd-core)
[![Build Status](https://travis-ci.org/react-dnd/dnd-core.svg?branch=main)](https://travis-ci.org/react-dnd/dnd-core)
[![Test Coverage](https://codeclimate.com/github/react-dnd/dnd-core/badges/coverage.svg)](https://codeclimate.com/github/react-dnd/dnd-core)

# dnd-core

Drag and Drop stateful engine - no GUI.

This is a clean implementation of drag and drop primitives that does not depend on the browser.
It powers [React DnD](https://github.com/react-dnd/react-dnd) internally.

## Wat?

To give you a better idea:

- There is no DOM here
- We let you define drop target and drag source logic
- We let you supply custom underlying implementations (console, DOM via jQuery, React, React Native, _whatever_)
- We manage drag source and drop target interaction

This was written to support some rather complicated scenarios that were too hard to implement in [React DnD](https://github.com/react-dnd/react-dnd) due to its current architecture:

- [Mocking drag and drop interaction in tests](https://github.com/react-dnd/react-dnd/issues/55)
- [Full support for arbitrary nesting and handling drag sources and drop targets](https://github.com/react-dnd/react-dnd/issues/87)
- [Dragging multiple items at once](https://github.com/react-dnd/react-dnd/issues/14)
- [Even when source is removed, letting another drag source “represent it” (e.g. card disappeared from one Kanban list, reappeared in another one)](https://github.com/react-dnd/react-dnd/pull/64#issuecomment-76118757)

As it turns out, these problems are much easier to solve when DOM is thrown out of the window.

## What's the API like?

[Tests](https://github.com/react-dnd/dnd-core/tree/main/test) should give you some idea. You register drag sources and drop targets, connect a backend (you can use barebones `TestBackend` or implement a fancy real one yourself), and your drag sources and drop targets magically begin to interact.

![](http://i.imgur.com/6l8CpxZ.png)

---
_Source: https://npm.io/package/dnd-core · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
