Skip to main content
@dnd-kit/abstract is the foundational package of dnd-kit that provides a framework-agnostic implementation of drag and drop functionality. It can be used to build drag and drop interfaces in any JavaScript environment.

Overview

The abstract package provides the core primitives and APIs for:
  • Drag and Drop Management: Centralized orchestration of drag operations
  • Entities: Draggable and Droppable primitives for defining interactive elements
  • Sensors: Pluggable input handlers for mouse, touch, keyboard, and custom interactions
  • Modifiers: Transform drag behavior with constraints, snapping, and custom logic
  • Plugins: Extend functionality with reusable, composable behaviors
  • Collision Detection: Flexible algorithms for determining drop targets
  • Event System: Comprehensive event lifecycle hooks

Installation

Core Exports

Manager

DragDropManager

Central orchestrator for all drag and drop operations

Entities

Draggable

Entities that can be dragged

Droppable

Entities that can receive draggables

Extensibility

Sensors

Input handlers for drag interactions

Modifiers

Transform drag behavior

Plugins

Extend drag and drop functionality

Type Definitions

UniqueIdentifier

Type representing a unique identifier for entities.

Data

Type representing arbitrary data associated with an entity.

Type

Type representing the type/category of an entity.
Used to categorize entities and implement type-based filtering or matching between draggables and droppables.

Event System

The abstract package provides a comprehensive event system for monitoring drag and drop operations:

Event Types

Fired when collisions are detected between draggables and droppables.

Using Events

Collision Detection

The package provides utilities for collision detection:

CollisionPriority

Priority levels for collision detection.

CollisionType

Types of collision detection.

Collision Interface

CollisionDetector

Function type for custom collision detection.

sortCollisions

Utility function to sort collisions by priority and value.

Customizable Type

Many configuration options accept a Customizable type that allows either a direct value or a function that receives defaults:

Examples

resolveCustomizable

Utility function to resolve customizable values:

Renderer

Type for handling visual rendering of drag operations.
The renderer’s rendering promise resolves when the current render cycle is complete, allowing for coordination between drag operations and visual updates.

Architecture

The abstract package follows a plugin-based architecture:

Next Steps

DragDropManager

Learn about the central manager API

Draggable

Create draggable entities

Droppable

Create droppable entities

Sensors

Implement input handlers