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/shapes.md
View on GitHub# Node Shapes in Blazor Diagram
## Table of Contents
- [Overview](#overview)
- [Basic Shapes](#basic-shapes)
- [Flow Shapes](#flow-shapes)
- [Text Shapes](#text-shapes)
- [Image Shapes](#image-shapes)
- [Path Shapes](#path-shapes)
- [HTML Template Shapes](#html-template-shapes)
- [SVG (Native) Shapes](#svg-native-shapes)
- [Choosing the Right Shape Type](#choosing-the-right-shape-type)
---
## Overview
Each `Node` can render different shape types using its `Shape` property. Set the appropriate shape class to control how the node looks.
---
## Basic Shapes
Use `BasicShape` for standard geometric shapes (rectangle, ellipse, triangle, etc.):
```razor
new Node
{
ID = "node1", OffsetX = 200, OffsetY = 200,
Width = 100, Height = 60,
Shape = new BasicShape
{
Type = NodeShapes.Basic,
Shape = NodeBasicShapes.Rectangle,
CornerRadius = 10 // optional rounded corners
},
Style = new ShapeStyle { Fill = "#6BA5D7", StrokeColor = "white" }
}
```
Common `NodeBasicShapes` values:
`Rectangle`, `Ellipse`, `Triangle`, `RightTriangle`, `Parallelogram`, `Pentagon`, `Hexagon`, `Octagon`, `Star`, `Cross`, `Diamond`, `Cylinder`
---
## Flow Shapes
Use `FlowShape` for standard flowchart shapes (process, decision, terminator, etc.):
```razor
new Node
{
ID = "decision",
OffsetX = 300, OffsetY = 200,
Width = 120, Height = 80,
Shape = new FlowShape
{
Type = NodeShapes.Flow,
Shape = NodeFlowShapes.Decision
},
Style = new ShapeStyle { Fill = "#FFD700", StrokeColor = "#B8860B" }
}
```
Common `NodeFlowShapes` values:
`Process`, `Decision`, `Terminator`, `PredefinedProcess`, `Document`, `MultiDocument`, `ManualInput`, `ManualOperation`, `Preparation`, `Data`, `Card`, `DirectData`, `SequentialData`, `Sort`, `Delay`, `Merge`
> **⚠️ `NodeFlowShapes.Database` does NOT exist** — using it causes `CS0117`.
> Use `NodeFlowShapes.DirectData` or `NodeFlowShapes.Data` to represent a data store:
> ```csharp
> // ❌ Wrong — CS0117: NodeFlowShapes does not contain a definition for 'Database'
> Shape = NodeFlowShapes.Database
>
> // ✅ Correct alternatives
> Shape = NodeFlowShapes.DirectData // cylinder-like data store shape
> Shape = NodeFlowShapes.Data // parallelogram data shape
> ```
---
## Text Shapes
Use `TextShape` when you want a text-only node (no border or fill):
```razor
new Node
{
ID = "label1",
OffsetX = 200, OffsetY = 100,
Width = 150, Height = 40,
Shape = new TextShape
{
Content = "Section Title"
},
Style = new TextStyle
{
FontSize = 16,
Bold = true,
Color = "#333333"
}
}
```
> Use annotations on regular nodes for simple labels; use `TextShape` when the text itself is the node.
---
## Image Shapes
Use `ImageShape` to display an image inside a node:
```razor
new Node
{
ID = "img1",
OffsetX = 200, OffsetY = 200,
Width = 120, Height = 80,
Shape = new ImageShape
{
Type = NodeShapes.Image,
Source = "https://example.com/logo.png",
// Source can also be a Base64 data URI: "data:image/png;base64,..."
Scale = DiagramScale.Meet, // Meet | Slice | None
ImageAlign = ImageAlignment.XMidYMid // controls alignment within the node bounds
}
}
```
> The correct property name is **`ImageAlign`**:
> ```csharp
> ImageAlign = ImageAlignment.XMidYMid
> ```
> **⚠️ `Stretch` does NOT exist** in the Syncfusion Blazor Diagram namespace.
> Use `DiagramScale` (enum: `None`, `Meet`, `Slice`) for the `Scale` property.
```csharp
Scale = DiagramScale.Meet
```
---
## Path Shapes
Use `PathShape` to draw a custom shape using an SVG path:
```razor
new Node
{
ID = "custom1",
OffsetX = 200, OffsetY = 200,
Width = 100, Height = 100,
Shape = new PathShape
{
Type = NodeShapes.Path,
Data = "M 0,50 L 50,0 L 100,50 L 50,100 Z" // SVG path data
},
Style = new ShapeStyle { Fill = "#E88A1A", StrokeColor = "#C07013" }
}
```
---
## HTML Template Shapes
Use `HtmlShape` to render any Blazor/HTML content inside a node. Requires `@ref` on the diagram and use of templates:
```razor
<SfDiagramComponent Height="600px" @ref="_diagram" Nodes="@nodes">
<DiagramTemplates>
<NodeTemplate>
@{
var node = (context as Node);
if (node?.Shape.Type == NodeShapes.HTML)
{
<div style="padding:8px; background:#f5f5f5; border:1px solid #ddd;">
<strong>@node.Annotations?.FirstOrDefault()?.Content</strong>
<br />Custom HTML Content
</div>
}
}
</NodeTemplate>
</DiagramTemplates>
</SfDiagramComponent>
@code {
// Node using HtmlShape
nodes.Add(new Node
{
ID = "htmlNode",
OffsetX = 300, OffsetY = 200,
Width = 180, Height = 80,
Shape = new Shape { Type = NodeShapes.HTML }
});
}
```
> **Note:** HTML nodes are not included in diagram exports (PNG/JPEG). Use for interactive content only.
---
## SVG (Native) Shapes
Use `NativeShape` to embed raw SVG markup inside a node:
```razor
<SfDiagramComponent Height="600px" @ref="_diagram" Nodes="@nodes">
<DiagramTemplates>
<NodeTemplate>
@{
var node = (context as Node);
if (node?.Shape.Type == NodeShapes.SVG)
{
<svg><circle cx='50' cy='50' r='40' fill='#6BA5D7'/></svg>
}
}
</NodeTemplate>
</DiagramTemplates>
</SfDiagramComponent>
@code {
// Node using NativeShape
nodes.Add(new Node
{
ID = "svg1",
OffsetX = 200, OffsetY = 200,
Width = 100, Height = 100,
Shape = new Shape() { Type = NodeShapes.SVG },
});
}
```
---
## Choosing the Right Shape Type
| Goal | Shape Type |
|------|-----------|
| Standard geometric shapes | `BasicShape` |
| Flowchart diagrams | `FlowShape` |
| Text-only nodes | `TextShape` |
| Display images/logos | `ImageShape` |
| Custom SVG outlines | `PathShape` |
| Embedded HTML/Blazor content | `HtmlShape` |
| Raw SVG markup | `NativeShape` |
| BPMN process modeling | See [bpmn.md](bpmn.md) |
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 |