DragulaDropula 1.0.0
See the version list below for details.
dotnet add package DragulaDropula --version 1.0.0
NuGet\Install-Package DragulaDropula -Version 1.0.0
<PackageReference Include="DragulaDropula" Version="1.0.0" />
paket add DragulaDropula --version 1.0.0
#r "nuget: DragulaDropula, 1.0.0"
// Install DragulaDropula as a Cake Addin #addin nuget:?package=DragulaDropula&version=1.0.0 // Install DragulaDropula as a Cake Tool #tool nuget:?package=DragulaDropula&version=1.0.0
DragulaDropula
Library for simple Drag-And-Drop functionality in Blazor.
How to start using
- Add DradNDropController to Scoped Services.
builder.Service.AddScoped<DragNDropController>();
- Use DraggingZone component as an underlay for other draggable components.
- Done ✅
API
Components
- DraggingZone
Component you need to use as an underlay for Draggable components.
Parameters:
Width
- width of DraggingZone.
Height
- height of DraggingZone.
- Draggable
Component you can drag
Parameters:
ItemToDrop
- object you need to drop (Example below).
MustReturnBackOnDrop
- boolean parameter means this component will return to start position when it's dropped.
OnDrop
- if you need to run some logic when Draggable is dropped then put your method here.
- DropTarget
Component for creating dropping area
Parameters:
OnDrop
- your method for getting dropped DraggableModel (and ItemToDrop inside) and something else you need.
Example
Let's create a test page in blazor and use DragulaDropula here.
Page Test.razor
:
@page "/Test"
<DraggingZone Width="100vw" Height="100vh">
<h1>Some test here!</h1>
<Draggable ItemToDrop="@("Banana!")">
<div style="background-color: yellow; width: 100px; height: 100px; color: white;">
<span style="background-color: darkorange">The banana</span>
</div>
</Draggable>
<hr />
<DropTarget OnDrop="@(model => _result = model.ItemToDrop)">
<div style="background-color: sandybrown; width: 250px; height: 250px; color: black;">
The banana box
</div>
</DropTarget>
<hr />
The result is @(_result).
</DraggingZone>
@code {
private object _result = "nothing";
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Microsoft.AspNetCore.Components.Web (>= 6.0.7)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.