{"id":29195863,"url":"https://github.com/soenneker/soenneker.blazor.drawflow","last_synced_at":"2026-05-13T01:07:04.348Z","repository":{"id":302161640,"uuid":"1011491081","full_name":"soenneker/soenneker.blazor.drawflow","owner":"soenneker","description":"A Blazor interop library for drawflow.js","archived":false,"fork":false,"pushed_at":"2026-05-09T12:47:09.000Z","size":997,"stargazers_count":5,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-05-09T14:43:39.128Z","etag":null,"topics":["blazor","blazorlibrary","canvas","csharp","diagram","dotnet","drawflow","drawflowinterop"],"latest_commit_sha":null,"homepage":"https://soenneker.com","language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soenneker.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":".github/CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":".github/SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":"soenneker","thanks_dev":"soenneker"}},"created_at":"2025-06-30T22:51:22.000Z","updated_at":"2026-05-09T12:47:01.000Z","dependencies_parsed_at":"2025-06-30T23:02:24.009Z","dependency_job_id":"88a7f191-3e8e-4087-b2b5-f08c2611ab15","html_url":"https://github.com/soenneker/soenneker.blazor.drawflow","commit_stats":null,"previous_names":["soenneker/soenneker.blazor.drawflow"],"tags_count":354,"template":false,"template_full_name":null,"purl":"pkg:github/soenneker/soenneker.blazor.drawflow","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.blazor.drawflow","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.blazor.drawflow/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.blazor.drawflow/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.blazor.drawflow/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soenneker","download_url":"https://codeload.github.com/soenneker/soenneker.blazor.drawflow/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soenneker%2Fsoenneker.blazor.drawflow/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32961785,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-12T23:30:32.555Z","status":"ssl_error","status_checked_at":"2026-05-12T23:30:18.191Z","response_time":102,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["blazor","blazorlibrary","canvas","csharp","diagram","dotnet","drawflow","drawflowinterop"],"created_at":"2025-07-02T05:06:31.629Z","updated_at":"2026-05-13T01:07:04.303Z","avatar_url":"https://github.com/soenneker.png","language":"CSS","funding_links":["https://github.com/sponsors/soenneker","https://thanks.dev/soenneker"],"categories":[],"sub_categories":[],"readme":"[![NuGet](https://img.shields.io/nuget/v/soenneker.blazor.drawflow.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.blazor.drawflow/)\n[![](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.blazor.drawflow/codeql.yml?label=CodeQL\u0026style=for-the-badge)](https://github.com/soenneker/soenneker.blazor.drawflow/actions/workflows/codeql.yml)\n[![Build Status](https://img.shields.io/github/actions/workflow/status/soenneker/soenneker.blazor.drawflow/publish-package.yml?style=for-the-badge)](https://github.com/soenneker/soenneker.blazor.drawflow/actions/workflows/publish-package.yml)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/soenneker.blazor.drawflow.svg?style=for-the-badge)](https://www.nuget.org/packages/soenneker.blazor.drawflow/)\n[![](https://img.shields.io/badge/Demo-Live-blueviolet?style=for-the-badge\u0026logo=github)](https://soenneker.github.io/soenneker.blazor.drawflow)\n\n# ![](https://user-images.githubusercontent.com/4441470/224455560-91ed3ee7-f510-4041-a8d2-3fc093025112.png) Soenneker.Blazor.Drawflow\n\n**Soenneker.Blazor.Drawflow** is a lightweight, modern Blazor wrapper for [drawflow.js](https://github.com/jerosoler/Drawflow), enabling interactive node-based diagrams in your Blazor applications. It supports advanced features like modules, zoom, import/export, and full event handling.\n\n![image](https://github.com/user-attachments/assets/cda7f3b8-c440-4dcd-b035-54b2b03f0bef)\n\n## Features\n\n- **Node and Connection Management**: Add, remove, and update nodes and connections programmatically.\n- **Modules**: Organize nodes into modules and switch between them.\n- **Zoom \u0026 Pan**: Built-in zoom controls and canvas panning.\n- **Import/Export**: Serialize and restore flows as JSON.\n- **Event Handling**: Subscribe to all major events (node created, removed, selected, data changed, etc).\n- **Customizable**: Pass options to control rerouting, curvature, zoom limits, and more.\n- **CDN or Local Assets**: Load drawflow.js and CSS from CDN or local files.\n\n---\n\n## Installation\n\n```bash\ndotnet add package Soenneker.Blazor.Drawflow\n```\n\n---\n\n## Quick Start\n\n1. **Register Services** (in `Program.cs`):\n\n```csharp\nbuilder.Services.AddDrawflowInteropAsScoped();\n```\n\n2. **Add the Component** (in your `.razor` file):\n\n```razor\n\u003cDrawflow @ref=\"Flow\" Options=\"_options\" OnNodeCreated=\"HandleNodeCreated\" style=\"height:400px\"\u003e\u003c/Drawflow\u003e\n\n@code {\n    private Drawflow? Flow;\n    private readonly DrawflowOptions _options = new();\n\n    private Task HandleNodeCreated(string id)\n    {\n        Console.WriteLine($\"Node created {id}\");\n        return Task.CompletedTask;\n    }\n}\n```\n\n---\n\n### Event Callbacks\n\n```razor\n\u003cDrawflow\n    @ref=\"Flow\"\n    Options=\"_options\"\n    OnNodeCreated=\"HandleNodeCreated\"\n    OnNodeRemoved=\"HandleNodeRemoved\"\n    OnConnectionCreated=\"HandleConnectionCreated\"\n    OnDataChanged=\"HandleDataChanged\"\n    ... /\u003e\n```\n\n### Programmatic API\n\nThe Drawflow component implements `IDrawflow` interface, providing a clean API for programmatic control:\n\n```csharp\n// Using the component reference\nawait Flow.AddNode(\"github\", 1, 1, 150, 150, \"github\", new { name = \"GitHub\" }, \"\u003cdiv\u003eGitHub\u003c/div\u003e\");\nawait Flow.AddConnection(\"github\", \"slack\", \"output\", \"input\");\nawait Flow.ZoomIn();\n\n// Export as strongly-typed object\nDrawflowExport graph = await Flow.Export();\n\n// Export as JSON string\nstring json = await Flow.ExportAsJson();\n```\n\n### Interface Usage\n\nYou can also use the `IDrawflow` interface for dependency injection and testing:\n\n```csharp\n// In your service registration\nservices.AddScoped\u003cIDrawflow, Drawflow\u003e();\n\n// In your component or service\n@inject IDrawflow DrawflowService\n\n// Usage\nawait DrawflowService.AddNode(\"test\", 1, 1, 100, 100, \"test\", null, \"\u003cdiv\u003eTest\u003c/div\u003e\");\n```\n\n### Strongly-Typed Methods\n\nThe library provides overload methods that accept strongly-typed objects for better type safety and IntelliSense support:\n\n```csharp\n// Add node using strongly-typed DrawflowNode\nvar node = new DrawflowNode\n{\n    Name = \"MyNode\",\n    PosX = 100,\n    PosY = 100,\n    Class = \"my-node\",\n    Html = \"\u003cdiv\u003eMy Node\u003c/div\u003e\",\n    Data = new Dictionary\u003cstring, object\u003e { [\"key\"] = \"value\" }\n};\nawait Flow.AddNode(node);\n\n// Add module using strongly-typed DrawflowModule\nvar module = new DrawflowModule\n{\n    Data = new Dictionary\u003cstring, DrawflowNode\u003e\n    {\n        [\"node1\"] = new DrawflowNode { Name = \"Node1\", PosX = 100, PosY = 100 }\n    }\n};\nawait Flow.AddModule(\"MyModule\", module);\n\n// Import using strongly-typed DrawflowExport\nvar drawflowExport = new DrawflowExport\n{\n    Drawflow = new Dictionary\u003cstring, DrawflowModule\u003e\n    {\n        [\"Home\"] = new DrawflowModule { Data = new Dictionary\u003cstring, DrawflowNode\u003e() }\n    }\n};\nawait Flow.Import(drawflowExport);\n\n// Import from JSON string\nawait Flow.Import(jsonString);\n```\n\n### Options\n\n```csharp\nvar options = new DrawflowOptions {\n    Reroute = true,\n    Curvature = 0.3,\n    Zoom = 1.0,\n    ZoomMax = 2.0,\n    ZoomMin = 0.3,\n    DraggableInputs = true,\n    UseUuid = true,\n    ManualCreate = false // auto-create on render\n};\n```\n\n### Export Models\n\nThe library provides strongly-typed models for working with exported drawflow data:\n\n```csharp\n// Main graph structure\npublic class DrawflowExport\n{\n    public Dictionary\u003cstring, DrawflowModule\u003e? Drawflow { get; set; }\n}\n\n// Module containing nodes\npublic class DrawflowModule\n{\n    public Dictionary\u003cstring, DrawflowNode\u003e? Data { get; set; }\n}\n\n// Individual node with connections\npublic class DrawflowNode\n{\n    public string? Id { get; set; }\n    public string? Name { get; set; }\n    public Dictionary\u003cstring, object\u003e? Data { get; set; }\n    public Dictionary\u003cstring, DrawflowNodeIO\u003e? Inputs { get; set; }\n    public Dictionary\u003cstring, DrawflowNodeIO\u003e? Outputs { get; set; }\n    public int PosX { get; set; }\n    public int PosY { get; set; }\n}\n\n// Input/Output connections\npublic class DrawflowNodeIO\n{\n    public List\u003cDrawflowConnection\u003e? Connections { get; set; }\n}\n\n// Connection between nodes\npublic class DrawflowConnection\n{\n    public string? Node { get; set; }\n    public string? Input { get; set; }\n    public string? Output { get; set; }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.blazor.drawflow","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoenneker%2Fsoenneker.blazor.drawflow","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoenneker%2Fsoenneker.blazor.drawflow/lists"}