Skip to main content
Droppable represents an entity that can receive draggable items in a drag and drop operation. It extends the base Entity class with droppable-specific functionality including type-based acceptance rules, collision detection, and drop target status tracking.

Constructor

Creates a new droppable entity.
DroppableInput<T>
required
Configuration object for the droppable.
U | undefined
required
The drag and drop manager instance, or undefined for unmanaged entities.
extends Data
default:"Data"
Type parameter for the data associated with this droppable.
extends DragDropManager<any, any>
default:"DragDropManager<any, any>"
Type parameter for the manager type.

Properties

Inherited from Entity

UniqueIdentifier
The unique identifier of the entity. Can be updated dynamically.
T
The data associated with the entity.
U | undefined
The drag and drop manager instance.
boolean
Whether the entity is disabled.

Droppable-Specific

Type | Type[] | ((draggable: Draggable) => boolean) | undefined
Types of draggables that can be dropped here, or a function to determine compatibility.
Type | undefined
The type/category of the droppable entity.
CollisionDetector
The collision detector for this droppable.
CollisionPriority | number | undefined
The collision priority for this droppable.
Shape | undefined
The current shape of this droppable. Typically set automatically based on DOM measurements.

Computed Properties

isDropTarget

boolean
Checks if this droppable is the current drop target.
Returns true if this droppable’s ID matches the current drag operation’s target ID.

Methods

accepts()

Checks whether this droppable accepts a given draggable.
Draggable
required
The draggable to check compatibility for.
boolean
true if the draggable can be dropped here, false otherwise.
Logic:
  1. If accept is undefined, returns true (accepts all)
  2. If accept is a function, calls it with the draggable
  3. If draggable has no type, returns false
  4. If accept is an array, checks if it includes the draggable’s type
  5. If accept is a single type, checks for exact match

Inherited from Entity

register()

Registers the entity with its manager.
CleanupFunction | void
A cleanup function to unregister the entity, or void if no manager is set.

unregister()

Unregisters the entity from its manager.

destroy()

Cleans up the entity when it’s no longer needed.

Usage Examples

Basic Droppable

With Type Acceptance

With Custom Acceptance Logic

With Collision Priority

Checking Acceptance

Checking Drop Target Status

Dynamic Updates

TypeScript Types

With Custom Collision Detector

Monitoring Drop Events

Nested Droppables

CollisionPriority Enum

Higher priority droppables take precedence when multiple collisions are detected.

See Also