Drag and drop
Angular Bootstrap 5 Drag and drop plugin
Drag and Drop plugin built with Bootstrap 5. Examples of draggable list, cards, tables, grid, buttons. Available sort, copy, scroll, disable, delay, nested & other options.
Note: Read the API tab to find all available options and advanced customization
Draggable basic example
By adding mdbDraggable
directive you can make your custom element
draggable.
Drag me!
Custom container
If you want to have your draggable component in a container, just add
boundaryElement
directive with selector to your component.
Drag me!
Blocked axis
Thanks to [lockAxis]
input you can disable x or y axis.
Drag me!
Drag me!
Delay
You can set deley of starting dragging by adding
[delay]
input with miliseconds value.
Drag me after one second!
Disabled
You can set your draggable element as disabled by adding
[disabled]
with true
value.
Disabled
Scrolling option
When your draggable element is inside a scrollable container your component will scroll its while you will be near the edge.
Drag!
Sortable basic example
By adding mdbSortableContainer
directive you
can add sortable functionality to the items in a container. Note, only elements with mdbDraggable
directive name will be
able to sort.
Horizontal example
Sortable list will create no matter how rotated it is.
Grid example
Sortable list works with grid as well.
Multiple tables
By using [containers]
input you can connect your list with other container.
To do
Done
Coping items
By adding [copy]
input with value true
you can copy your items to
connected table.
Elements
Copy
Conditions
You can set your own conditions about permission to sending or coping items to connected table
by adding your custom function with true
/ false
return to
[enterPredicate]
input.
Numbers
Only odd numbers
Disabled sorting
By setting sorting
input to false
you can disable sorting
in table.
Sorting available
Sorting not available
Nested
To do
Done
Drag and drop - API
Installation
To install and configure the plugin follow our Plugins Installation Guide. Please remember to update all the plugin names and import paths. You can find all the necessary information in the Import section.
Import
Inputs
MdbDraggableDirective
Name | Type | Default | Description |
---|---|---|---|
boundaryElement
|
HTMLElement | String | body |
Defines boundary container for dragged element |
copy
|
Boolean | false |
Defines if dragged element should be moved or copied to new container |
data
|
any | - |
Defines draggable element data |
delay
|
Number | 0 |
Defines how long will deley exist before element starts to drag |
disabled
|
Boolean | false |
Defines whether element is able to drag or not |
handle
|
HTMLElement | String | - |
Defines drag handler of the element. Note, handler has to be inside of the dragging element |
lockAxis
|
'x' | 'y' | null | null |
Defines whether 'x' or 'y' axis is blocked |
MdbSortableContainerDirective
Name | Type | Default | Description |
---|---|---|---|
containers
|
MdbSortableContainer | String | [] |
Defines list of connected containers |
enterPredicate
|
Function | () => true |
Defines function which check access between tables |
sortingDisabled
|
Boolean | false |
Defines whether list is able to sort or not |
Outputs
MdbDraggableDirective
Name | Type | Description |
---|---|---|
dragStart
|
EventEmitter<HTMLElement> | Emitted on drag start. |
dragEnd
|
EventEmitter<HTMLElement> | Emitted on drag end. |
MdbSortableContainerDirective
Name | Type | Description |
---|---|---|
itemDrop
|
EventEmitter<MdbDropEvent> | Emitted on element drop in container |