Skip to content

Simple implementation of drag and drop and drop zone with React hooks

Notifications You must be signed in to change notification settings

sikozonpc/react-drag-drop-hook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Very simple boilerplate code to show how to create a drag and drop with a exposing hook.

Features:

  • Touch support;
  • Mouse support;
  • Droppable zone;
  • No Packages external packages;
  • Calculates overlap between draggable and droppable

Example code under App.tsx

Consuming example:

  const { translate, isDragging, isDraggableOverllapping, setTranslate } = useDragDrop(draggableRef, droppableRef, {
    onDrop: () => {
      resetToInitalPosition()
    },
  })

Codesandbox example

About

Simple implementation of drag and drop and drop zone with React hooks

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages