BASE

React DnD

React DnD

UI library · Free

A drag-and-drop library for React: connects drag sources and drop targets and helps build editors and sortable interfaces.

Also known as: react-dnd/react-dnd; react-drag-and-drop; react-dnd-library

Resource illustration: React DnD

Open resource ↗

What you can use for free

Code and local use under MIT.

Paid features and costs

Computing resources, self-hosting, and external services are paid for separately if used.

Access and limitations

Code and local use under MIT. Computing resources, self-hosting, and external services are paid for separately if used.

Use cases

  • Add dragging an object between React areas
  • Connect the drop callback to editor data changes

Example workflow

A possible workflow; this is not a report of hands-on testing.

Add dragging an object between React areas.

Before you start

  • The component's design, states, and data.
  • A compatible framework and the project's styles.

Steps

  1. Define drag sources, drop targets, and the drag payload.
  2. Connect the drop callback to editor data changes.
  3. Configure styles and check empty, loading, and error states.

Check your result

  • The keyboard, focus indicators, and a screen reader let users complete the action.
  • The component works on a narrow screen and with long data values.

Choosing React DnD

Add dragging an object between React areas

Choose this when

  • Add dragging an object between React areas
  • Connect the drop callback to editor data changes

Requirements

  • Wrap the drag-and-drop area in DndProvider with the selected backend or an existing DragDropManager.

Things to consider

  • Costs and limits of free use: Computing resources, self-hosting, and external services are paid for separately if used.
  • Terms of use: MIT for the code; dependencies have separate licenses.
  • The DndProvider API requires a backend or manager: merely displaying a draggable element is not enough to establish a shared drag-and-drop context.

Frequently asked questions

What can you use for free in React DnD?

Code and local use under MIT.

What additional costs might arise with React DnD?

Computing resources, self-hosting, and external services are paid for separately if used.

What terms of use matter for React DnD?

MIT for the code; dependencies have separate licenses.

How do you get started with React DnD?

Define drag sources, drop targets, and the drag payload. Connect the drop callback to editor data changes. Configure styles and check empty, loading, and error states.

Can you supply your own manager to React DnD?

In the primary DndProvider.tsx source, props are represented as two alternatives: manager, or backend with context/options. In the first case, the provider uses the supplied DragDropManager; in the second, it creates one from the backend. This allows explicit integration control rather than assuming an automatically selected engine.

License

MIT for the code; dependencies have separate licenses.

MIT — permissive license

You can use, modify, distribute, and sell the code, including in a closed-source commercial product. When sharing copies or substantial portions of the code, retain the license text and copyright notice. You do not need to open-source your entire project; the author provides no warranties.

License terms

Technologies and topics

  • React DnD
  • UI
  • Development

Sources

Other resources