Drag and Drop

A web component implementation of a HTML Drag and Drop API.

The user may select draggable elements with a mouse, drag those elements to a droppable element, and drop them by releasing the mouse button. A translucent representation of the draggable elements follows the pointer during the drag operation.

Example

Usage examples

Example
Item 1
Item 2
Download: 

Nested drag & drop

This example demonstrates how to nest multiple FluentDragContainer components to enable drag-and-drop interactions across hierarchical structures such as rows, columns, and elements. The key to making this multi-level drag-and-drop system work is the use of the StopPropagation property. By enabling it where appropriate, each nested FluentDragContainer can handle drag events independently-preventing unintended interference from parent containers. Each level supports independent drag behavior:

  • Rows can be reordered vertically.
  • Columns can be moved within the same row or between different rows.
  • Elements can be rearranged inside a column or moved across columns.
The yellow area indicates an empty drop zone inside a row. It accepts columns when a row does not contain any yet. Similarly, empty columns behave as drop zones for elements. This structure allows fully flexible layout editing with deep nesting and drag-and-drop handling at every level.

Example
Row: 1
Column: 1
Element: 1
Element: 2
Column: 2
Element: 3
Row: 2
Column: 3
Element: 4
Element: 5
Element: 6
Row: 3
Column: 4
Row: 4
Column: 5
Element: 7
Element: 8
Column: 6
Element: 9
Row: 5
Column: 7
Column: 8
Element: 10
Row: 6
Column: 9
Download: 

Documentation

FluentDragContainer<TItem> Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
OnDragEndAction<FluentDragEventArgs<TItem>>?
This event is fired when the drag operation ends (such as releasing a mouse button or hitting the Esc key).
OnDragEnterAction<FluentDragEventArgs<TItem>>?
This event is fired when a dragged element enters a valid drop target.
OnDragLeaveAction<FluentDragEventArgs<TItem>>?
This event is fired when a dragged element leaves a valid drop target.
OnDragOverAction<FluentDragEventArgs<TItem>>?
This event is fired when an element is being dragged over a valid drop target.
OnDragStartAction<FluentDragEventArgs<TItem>>?
This event is fired when the user starts dragging an element.
OnDropEndAction<FluentDragEventArgs<TItem>>?
This event is fired when an element is dropped on a valid drop target.

FluentDropZone<TItem> Class

Parameters

Name
Type
Default
Description
ChildContentRenderFragment?
Gets or sets the content to be rendered inside the component.
Draggablebool
False
Gets or sets a value indicating whether the element can be dragged.
Droppablebool
False
Gets or sets a value indicating whether the element can receive a dragged item.
ItemTItem?
Gets or sets the item to identify a draggable zone.
OnDragEndAction<FluentDragEventArgs<TItem>>?
This event is fired when the drag operation ends (such as releasing a mouse button or hitting the Esc key).
OnDragEnterAction<FluentDragEventArgs<TItem>>?
This event is fired when a dragged element enters a valid drop target.
OnDragLeaveAction<FluentDragEventArgs<TItem>>?
This event is fired when a dragged element leaves a valid drop target.
OnDragOverAction<FluentDragEventArgs<TItem>>?
This event is fired when an element is being dragged over a valid drop target.
OnDragStartAction<FluentDragEventArgs<TItem>>?
This event is fired when the user starts dragging an element.
OnDropEndAction<FluentDragEventArgs<TItem>>?
This event is fired when an element is dropped on a valid drop target.
StopPropagationbool
False
Gets or sets a way to prevent further propagation of the current event in the capturing and bubbling phases.

FluentDragEventArgs<TItem> Class

Properties

Name
Type
Default
Description
SourceFluentDropZone<TItem>
Gets the zone where the drag started.
TargetFluentDropZone<TItem>
Gets the zone where the drag ended.
An error has occurred. This application may no longer respond until reloaded. Reload 🗙