syncfusion/blazor-ui-components-skills / skills/syncfusion-blazor-diagram
syncfusion-blazor-diagram
VerifiedBuild and troubleshoot Syncfusion Blazor diagrams using SfDiagramComponent. Trigger for flowcharts, org charts, mind maps, BPMN, UML sequence, swimlanes, symbol palettes, nodes/connectors/ports/annotations, layouts, data binding, serialization (load/save), export/print, and collaborative editing questions. Provide Blazor + Syncfusion setup steps, configuration patterns, and sample snippets.
| File | Kind | Size |
|---|---|---|
| SKILL.md | skill md | 28.6 KB |
| references/advanced-features.md | markdown | 10.0 KB |
| references/annotations.md | markdown | 11.9 KB |
| references/bpmn.md | markdown | 6.6 KB |
| references/collaborative-editing.md | markdown | 7.0 KB |
| references/connectors.md | markdown | 6.4 KB |
| references/data-binding.md | markdown | 12.8 KB |
| references/events.md | markdown | 52.7 KB |
| references/export-print.md | markdown | 5.9 KB |
| references/getting-started.md | markdown | 5.4 KB |
| references/interaction.md | markdown | 36.7 KB |
| references/layout.md | markdown | 12.3 KB |
| references/nodes.md | markdown | 8.6 KB |
| references/overview-component.md | markdown | 5.5 KB |
| references/ports.md | markdown | 5.1 KB |
| references/serialization.md | markdown | 3.5 KB |
| references/shapes.md | markdown | 6.2 KB |
| references/styling.md | markdown | 6.1 KB |
| references/swimlane.md | markdown | 6.1 KB |
| references/symbol-palette.md | markdown | 7.7 KB |
| references/uml-class-diagram.md | markdown | 25.5 KB |
| references/uml-sequence.md | markdown | 6.5 KB |
references/getting-started.md
View on GitHub# Getting Started with Syncfusion Blazor Diagram
## Table of Contents
- [Overview](#overview)
- [Installation](#installation)
- [Setup: Blazor Server App](#setup-blazor-server-app)
- [Setup: Blazor Web App (.NET 8+)](#setup-blazor-web-app-net-8)
- [Setup: Blazor WebAssembly](#setup-blazor-webassembly)
- [Setup: MAUI Blazor](#setup-maui-blazor)
- [Add the Diagram Component](#add-the-diagram-component)
- [Minimal Working Example](#minimal-working-example)
- [Troubleshooting](#troubleshooting)
---
## Overview
The Syncfusion Blazor Diagram component (`SfDiagramComponent`) enables interactive diagramming — flowcharts, org charts, mind maps, BPMN, UML, and custom diagrams. It supports Blazor Server, Blazor WebAssembly, Blazor Web App (.NET 8+), and MAUI Blazor.
---
## Installation
Install both the diagram and themes NuGet packages:
```bash
dotnet add package Syncfusion.Blazor.Diagram
dotnet add package Syncfusion.Blazor.Themes
```
Or via Visual Studio NuGet Package Manager, search for `Syncfusion.Blazor.Diagram`.
---
## Setup: Blazor Server App
**1. Register service in `Program.cs`:**
```csharp
using Syncfusion.Blazor;
builder.Services.AddSyncfusionBlazor();
```
**2. Import namespaces in `_Imports.razor`:**
```razor
@using Syncfusion.Blazor
@using Syncfusion.Blazor.Diagram
```
**3. Add theme CSS and script in `App.razor`:**
```html
<head>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>
<body>
...
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>
</body>
```
---
## Setup: Blazor Web App (.NET 8+)
**1. Register service in both `Program.cs` files (if using WebAssembly/Auto render mode):**
```csharp
// Server Program.cs
builder.Services.AddRazorComponents()
.AddInteractiveServerComponents()
.AddInteractiveWebAssemblyComponents();
builder.Services.AddSyncfusionBlazor();
```
```csharp
// Client Program.cs (for WebAssembly/Auto render mode)
builder.Services.AddSyncfusionBlazor();
```
**2. Set render mode at the top of the component page:**
```razor
@rendermode InteractiveServer
@* or InteractiveWebAssembly / InteractiveAuto *@
```
> **When to use which render mode:**
> - `InteractiveServer` — default for most apps, real-time via SignalR
> - `InteractiveWebAssembly` — fully client-side, larger download
> - `InteractiveAuto` — starts as Server, switches to WASM after download
---
## Setup: Blazor WebAssembly
```csharp
// Program.cs
using Syncfusion.Blazor;
builder.Services.AddSyncfusionBlazor();
await builder.Build().RunAsync();
```
Add theme/script references in `wwwroot/index.html`:
```html
<head>
<link href="_content/Syncfusion.Blazor.Themes/bootstrap5.css" rel="stylesheet" />
</head>
<body>
<script src="_content/Syncfusion.Blazor.Core/scripts/syncfusion-blazor.min.js"></script>
</body>
```
---
## Setup: MAUI Blazor
See [getting-started-with-maui-app.md](https://blazor.syncfusion.com/documentation/diagram/getting-started-with-maui-app) for platform-specific MAUI setup. Key difference: use `MauiProgram.cs` for service registration.
---
## Add the Diagram Component
Add `SfDiagramComponent` to a `.razor` page:
```razor
<SfDiagramComponent Width="100%" Height="600px" />
```
Minimum required props: `Width` and `Height`.
---
## Minimal Working Example
A diagram with one node and one connector:
```razor
@using Syncfusion.Blazor.Diagram
<SfDiagramComponent Width="100%" Height="600px"
Nodes="@nodes"
Connectors="@connectors" />
@code {
DiagramObjectCollection<Node> nodes = new();
DiagramObjectCollection<Connector> connectors = new();
protected override void OnInitialized()
{
nodes.Add(new Node
{
ID = "node1", OffsetX = 150, OffsetY = 150,
Width = 120, Height = 50,
Style = new ShapeStyle { Fill = "#6BA5D7", StrokeColor = "white" },
Annotations = new DiagramObjectCollection<ShapeAnnotation>
{
new ShapeAnnotation { Content = "Start" }
}
});
nodes.Add(new Node
{
ID = "node2", OffsetX = 350, OffsetY = 150,
Width = 120, Height = 50,
Style = new ShapeStyle { Fill = "#6BA5D7", StrokeColor = "white" },
Annotations = new DiagramObjectCollection<ShapeAnnotation>
{
new ShapeAnnotation { Content = "End" }
}
});
connectors.Add(new Connector
{
ID = "conn1",
SourceID = "node1",
TargetID = "node2",
Type = ConnectorSegmentType.Orthogonal
});
}
}
```
---
## Available Themes
| CSS File | Theme |
|----------|-------|
| `bootstrap5.css` | Bootstrap 5 |
| `material.css` | Material Design |
| `fluent.css` | Fluent UI |
| `tailwind.css` | Tailwind CSS |
| `fabric.css` | Office Fabric |
| `material-dark.css` | Material Dark |
---
## Troubleshooting
| Issue | Fix |
|-------|-----|
| Diagram not rendering | Verify `AddSyncfusionBlazor()` is called in `Program.cs` |
| Styles not applied | Check theme CSS link is inside `<head>` |
| Script errors | Ensure `syncfusion-blazor.min.js` is at end of `<body>` |
| Component not interactive | Add `@rendermode InteractiveServer` (Blazor Web App) |
| License warning | Call `SyncfusionLicenseProvider.RegisterLicense("key")` before `builder.Build()` |
| Node ID errors | Node/Connector IDs must not start with a number or contain underscores/spaces |
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack." | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |
| ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt. | Stars: 196k | Updated | Claude CodeCodex | Verified | Install |