Angular Drag and Drop Between Multiple Connected Lists

View code

Learn how to implement drag and drop between multiple lists in Angular. This example demonstrates how sortable lists can be connected to each other, allowing seamless item transfer across different containers.

Note the sortable CSS class (provides min-height) so the lists never collapse when empty, maintaining a consistent drag-and-drop experience.

Transfer Items Between Lists Example

These lists are connected using the group option. You can drag and drop elements across different lists, making it perfect for kanban boards, task managers, and categorization interfaces.

  • Element 1
  • Element 2
  • Element 3
  • Element 4
  • Element 5
  • Element 6
  • Element 7
  • Element 8
  • Element 9
  • Element 10

and the actual state is

[ "1", "2", "3", "4", "5" ]
[ "6", "7", "8", "9", "10" ]

Clone items

The list 1 is a clone factory and list 2 can be its target.

  • Element 1
  • Element 2
  • Element 3
  • Element 4
  • Element 5
  • Element 6
  • Element 7
  • Element 8
  • Element 9
  • Element 10

and the actual state is

[ "1", "2", "3", "4", "5" ]
[ "6", "7", "8", "9", "10" ]

Super complicated example

These lists are connected together. You can drag / drop elements across the lists. Pay attention to the sortable CSS class (gives a min-height) that does not allow list to become invisible when all items are gone

1. This list cannot accept items
  • Element 1
  • Element 2
  • Element 3
  • Element 4
  • Element 5
2. This is a normal list
  • Element 6
  • Element 7
  • Element 8
  • Element 9
  • Element 10
3. This list clones its children
  • Element 11
  • Element 12
4. Only #1 can put here
  • Element 13

and the actual state is

[ "1", "2", "3", "4", "5" ]
[ "6", "7", "8", "9", "10" ]
[ "11", "12" ]
[ "13" ]