Soenneker.Blazor.Drawflow
4.0.128
Prefix Reserved
dotnet add package Soenneker.Blazor.Drawflow --version 4.0.128
NuGet\Install-Package Soenneker.Blazor.Drawflow -Version 4.0.128
<PackageReference Include="Soenneker.Blazor.Drawflow" Version="4.0.128" />
<PackageVersion Include="Soenneker.Blazor.Drawflow" Version="4.0.128" />
<PackageReference Include="Soenneker.Blazor.Drawflow" />
paket add Soenneker.Blazor.Drawflow --version 4.0.128
#r "nuget: Soenneker.Blazor.Drawflow, 4.0.128"
#:package Soenneker.Blazor.Drawflow@4.0.128
#addin nuget:?package=Soenneker.Blazor.Drawflow&version=4.0.128
#tool nuget:?package=Soenneker.Blazor.Drawflow&version=4.0.128
Soenneker.Blazor.Drawflow
Soenneker.Blazor.Drawflow is a lightweight, modern Blazor wrapper for drawflow.js, enabling interactive node-based diagrams in your Blazor applications. It supports advanced features like modules, zoom, import/export, and full event handling.
Features
- Node and Connection Management: Add, remove, and update nodes and connections programmatically.
- Modules: Organize nodes into modules and switch between them.
- Zoom & Pan: Built-in zoom controls and canvas panning.
- Import/Export: Serialize and restore flows as JSON.
- Event Handling: Subscribe to all major events (node created, removed, selected, data changed, etc).
- Customizable: Pass options to control rerouting, curvature, zoom limits, and more.
- CDN or Local Assets: Load drawflow.js and CSS from CDN or local files.
Installation
dotnet add package Soenneker.Blazor.Drawflow
Quick Start
- Register Services (in
Program.cs):
builder.Services.AddDrawflowInteropAsScoped();
- Add the Component (in your
.razorfile):
<Drawflow @ref="Flow" Options="_options" OnNodeCreated="HandleNodeCreated" style="height:400px"></Drawflow>
@code {
private Drawflow? Flow;
private readonly DrawflowOptions _options = new();
private Task HandleNodeCreated(string id)
{
Console.WriteLine($"Node created {id}");
return Task.CompletedTask;
}
}
Event Callbacks
<Drawflow
@ref="Flow"
Options="_options"
OnNodeCreated="HandleNodeCreated"
OnNodeRemoved="HandleNodeRemoved"
OnConnectionCreated="HandleConnectionCreated"
OnDataChanged="HandleDataChanged"
... />
Programmatic API
The Drawflow component implements IDrawflow interface, providing a clean API for programmatic control:
// Using the component reference
await Flow.AddNode("github", 1, 1, 150, 150, "github", new { name = "GitHub" }, "<div>GitHub</div>");
await Flow.AddConnection("github", "slack", "output", "input");
await Flow.ZoomIn();
// Export as strongly-typed object
DrawflowExport graph = await Flow.Export();
// Export as JSON string
string json = await Flow.ExportAsJson();
Interface Usage
You can also use the IDrawflow interface for dependency injection and testing:
// In your service registration
services.AddScoped<IDrawflow, Drawflow>();
// In your component or service
@inject IDrawflow DrawflowService
// Usage
await DrawflowService.AddNode("test", 1, 1, 100, 100, "test", null, "<div>Test</div>");
Strongly-Typed Methods
The library provides overload methods that accept strongly-typed objects for better type safety and IntelliSense support:
// Add node using strongly-typed DrawflowNode
var node = new DrawflowNode
{
Name = "MyNode",
PosX = 100,
PosY = 100,
Class = "my-node",
Html = "<div>My Node</div>",
Data = new Dictionary<string, object> { ["key"] = "value" }
};
await Flow.AddNode(node);
// Add module using strongly-typed DrawflowModule
var module = new DrawflowModule
{
Data = new Dictionary<string, DrawflowNode>
{
["node1"] = new DrawflowNode { Name = "Node1", PosX = 100, PosY = 100 }
}
};
await Flow.AddModule("MyModule", module);
// Import using strongly-typed DrawflowExport
var drawflowExport = new DrawflowExport
{
Drawflow = new Dictionary<string, DrawflowModule>
{
["Home"] = new DrawflowModule { Data = new Dictionary<string, DrawflowNode>() }
}
};
await Flow.Import(drawflowExport);
// Import from JSON string
await Flow.Import(jsonString);
Options
var options = new DrawflowOptions {
Reroute = true,
Curvature = 0.3,
Zoom = 1.0,
ZoomMax = 2.0,
ZoomMin = 0.3,
DraggableInputs = true,
UseUuid = true,
ManualCreate = false // auto-create on render
};
Export Models
The library provides strongly-typed models for working with exported drawflow data:
// Main graph structure
public class DrawflowExport
{
public Dictionary<string, DrawflowModule>? Drawflow { get; set; }
}
// Module containing nodes
public class DrawflowModule
{
public Dictionary<string, DrawflowNode>? Data { get; set; }
}
// Individual node with connections
public class DrawflowNode
{
public string? Id { get; set; }
public string? Name { get; set; }
public Dictionary<string, object>? Data { get; set; }
public Dictionary<string, DrawflowNodeIO>? Inputs { get; set; }
public Dictionary<string, DrawflowNodeIO>? Outputs { get; set; }
public int PosX { get; set; }
public int PosY { get; set; }
}
// Input/Output connections
public class DrawflowNodeIO
{
public List<DrawflowConnection>? Connections { get; set; }
}
// Connection between nodes
public class DrawflowConnection
{
public string? Node { get; set; }
public string? Input { get; set; }
public string? Output { get; set; }
}
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net10.0
- Soenneker.Blazor.Drawflow.Dtos (>= 4.0.7)
- Soenneker.Blazor.Utils.InteropEventListener (>= 4.0.3766)
- Soenneker.Blazor.Utils.ResourceLoader (>= 4.0.1525)
- Soenneker.Extensions.CancellationTokens (>= 4.0.6)
- Soenneker.Extensions.List (>= 4.0.941)
- Soenneker.Quark.Components.Core.Cancellable (>= 4.0.18)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 4.0.128 | 157 | 11/22/2025 |
| 4.0.127 | 223 | 11/22/2025 |
| 4.0.126 | 254 | 11/21/2025 |
| 4.0.125 | 263 | 11/21/2025 |
| 4.0.124 | 295 | 11/21/2025 |
| 4.0.123 | 323 | 11/21/2025 |
| 4.0.122 | 353 | 11/21/2025 |
| 4.0.121 | 364 | 11/21/2025 |
| 4.0.120 | 370 | 11/21/2025 |
| 4.0.119 | 270 | 11/12/2025 |
| 4.0.118 | 265 | 11/12/2025 |
| 4.0.117 | 268 | 11/12/2025 |
| 4.0.116 | 266 | 11/11/2025 |
| 4.0.115 | 272 | 11/11/2025 |
| 4.0.114 | 272 | 11/11/2025 |
| 4.0.113 | 261 | 11/11/2025 |
| 4.0.112 | 254 | 11/10/2025 |
| 4.0.111 | 248 | 11/10/2025 |
| 4.0.110 | 211 | 11/10/2025 |
| 4.0.109 | 134 | 11/7/2025 |
| 4.0.108 | 147 | 11/7/2025 |
| 4.0.107 | 162 | 11/7/2025 |
| 4.0.106 | 171 | 11/7/2025 |
| 4.0.105 | 186 | 11/6/2025 |
| 4.0.104 | 177 | 11/6/2025 |
| 4.0.103 | 174 | 11/6/2025 |
| 4.0.102 | 185 | 11/6/2025 |
| 4.0.101 | 181 | 11/4/2025 |
| 4.0.100 | 175 | 11/4/2025 |
| 4.0.99 | 180 | 11/4/2025 |
| 4.0.98 | 179 | 11/4/2025 |
| 4.0.97 | 173 | 10/31/2025 |
| 4.0.96 | 183 | 10/30/2025 |
| 4.0.95 | 186 | 10/30/2025 |
| 4.0.94 | 189 | 10/30/2025 |
| 4.0.93 | 180 | 10/30/2025 |
| 4.0.92 | 179 | 10/30/2025 |
| 4.0.91 | 176 | 10/30/2025 |
| 4.0.90 | 180 | 10/30/2025 |
| 4.0.89 | 182 | 10/29/2025 |
| 3.0.88 | 145 | 10/24/2025 |
| 3.0.87 | 183 | 10/17/2025 |
| 3.0.86 | 161 | 10/16/2025 |
| 3.0.85 | 174 | 10/16/2025 |
| 3.0.84 | 168 | 10/15/2025 |
| 3.0.83 | 165 | 10/15/2025 |
| 3.0.82 | 161 | 10/15/2025 |
| 3.0.81 | 158 | 10/8/2025 |
| 3.0.80 | 178 | 9/30/2025 |
| 3.0.79 | 120 | 9/26/2025 |
| 3.0.78 | 223 | 9/22/2025 |
| 3.0.77 | 181 | 9/20/2025 |
| 3.0.76 | 182 | 9/20/2025 |
| 3.0.75 | 178 | 9/20/2025 |
| 3.0.74 | 258 | 9/19/2025 |
| 3.0.73 | 292 | 9/19/2025 |
| 3.0.72 | 296 | 9/17/2025 |
| 3.0.71 | 310 | 9/17/2025 |
| 3.0.70 | 303 | 9/17/2025 |
| 3.0.69 | 290 | 9/17/2025 |
| 3.0.68 | 299 | 9/17/2025 |
| 3.0.67 | 297 | 9/17/2025 |
| 3.0.66 | 306 | 9/17/2025 |
| 3.0.65 | 304 | 9/16/2025 |
| 3.0.64 | 185 | 9/10/2025 |
| 3.0.63 | 171 | 9/10/2025 |
| 3.0.62 | 175 | 9/10/2025 |
| 3.0.61 | 174 | 9/9/2025 |
| 3.0.60 | 174 | 9/9/2025 |
| 3.0.59 | 176 | 9/9/2025 |
| 3.0.58 | 162 | 9/9/2025 |
| 3.0.57 | 184 | 9/7/2025 |
| 3.0.56 | 147 | 9/7/2025 |
| 3.0.55 | 143 | 9/7/2025 |
| 3.0.54 | 142 | 9/6/2025 |
| 3.0.53 | 146 | 9/6/2025 |
| 3.0.52 | 116 | 9/5/2025 |
| 3.0.51 | 179 | 9/5/2025 |
| 3.0.50 | 182 | 9/4/2025 |
| 3.0.49 | 180 | 9/4/2025 |
| 3.0.48 | 178 | 9/4/2025 |
| 3.0.47 | 196 | 9/4/2025 |
| 3.0.46 | 179 | 9/4/2025 |
| 3.0.45 | 177 | 9/3/2025 |
| 3.0.44 | 188 | 9/3/2025 |
| 3.0.43 | 181 | 9/3/2025 |
| 3.0.42 | 114 | 8/22/2025 |
| 3.0.41 | 145 | 8/17/2025 |
| 3.0.40 | 146 | 8/17/2025 |
| 3.0.39 | 152 | 8/15/2025 |
| 3.0.38 | 171 | 8/12/2025 |
| 3.0.37 | 171 | 8/12/2025 |
| 3.0.36 | 178 | 8/12/2025 |
| 3.0.35 | 163 | 8/12/2025 |
| 3.0.34 | 173 | 8/11/2025 |
| 3.0.33 | 175 | 8/11/2025 |
| 3.0.32 | 170 | 8/11/2025 |
| 3.0.31 | 161 | 8/11/2025 |
| 3.0.30 | 168 | 8/11/2025 |
| 3.0.29 | 255 | 8/7/2025 |
| 3.0.28 | 261 | 8/5/2025 |
| 3.0.27 | 243 | 8/5/2025 |
| 3.0.26 | 240 | 8/5/2025 |
| 3.0.25 | 253 | 8/5/2025 |
| 3.0.24 | 253 | 8/5/2025 |
| 3.0.23 | 239 | 8/5/2025 |
| 3.0.22 | 144 | 7/30/2025 |
| 3.0.21 | 496 | 7/24/2025 |
| 3.0.20 | 514 | 7/21/2025 |
| 3.0.19 | 266 | 7/20/2025 |
| 3.0.18 | 264 | 7/19/2025 |
| 3.0.17 | 82 | 7/19/2025 |
| 3.0.16 | 94 | 7/19/2025 |
| 3.0.13 | 118 | 7/18/2025 |
| 3.0.12 | 207 | 7/9/2025 |
| 3.0.11 | 175 | 7/9/2025 |
| 3.0.10 | 187 | 7/9/2025 |
| 3.0.9 | 171 | 7/9/2025 |
| 3.0.8 | 177 | 7/3/2025 |
| 3.0.7 | 184 | 7/3/2025 |
| 3.0.6 | 170 | 7/3/2025 |
| 3.0.5 | 165 | 7/1/2025 |
| 3.0.4 | 170 | 7/1/2025 |
| 3.0.3 | 173 | 7/1/2025 |
| 3.0.1 | 172 | 6/30/2025 |