Search code examples
reactjsdrag-and-dropreact-beautiful-dnd

Drag and Drop: Create columns dynamically when the element is dropped


I'm using react-beautiful-dnd to copy and element drop into a columns previously created.

But I wonder if there is any possibility when I'm dragging an element and I drop it, it creates me the column dynamically to drop it ? could I make it ?

if react-beautiful-dnd doesn't work, what other plugin of React could do it ?

any suggestion..


Solution

  • I am curious about the same thing, but I suspect that it is not possible.

    The approach I can think of is to make the parent of your droppable columns also a Droppable itself. Then onDragEnd you could determine where to insert a new column, automatically adding the Draggable.

    While the documentation has a page for Changes while dragging, it includes these rules (and others) that make me think this approach will not work:

    • You can only add or remove Draggables that are of the same type as the dragging item.
    • You cannot add or remove a <Droppable /> during a drag.

    Also note the warning (currently, at the top of the page) that changes while dragging are currently only supported in version 11.x