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/symbol-palette.md
View on GitHub# Symbol Palette in Blazor Diagram
## Table of Contents
- [Overview](#overview)
- [Setup](#setup)
- [Drag Preview Size](#drag-preview-size)
- [Adding Nodes to Palette](#adding-nodes-to-palette)
- [Adding Connectors to Palette](#adding-connectors-to-palette)
- [Multiple Palette Groups](#multiple-palette-groups)
- [Linking Palette to Diagram](#linking-palette-to-diagram)
- [Custom Symbol Styling](#custom-symbol-styling)
- [Common Gotchas](#common-gotchas)
---
## Overview
The `SfSymbolPaletteComponent` displays groups of reusable nodes and connectors that users can drag and drop into a diagram. Useful for building diagram toolboxes (flowchart shapes, BPMN elements, network icons, etc.).
---
## Setup
Add the `SfSymbolPaletteComponent` alongside the diagram. Requires the `Syncfusion.Blazor.Diagram.SymbolPalette` namespace:
```razor
@using Syncfusion.Blazor.Diagram
@using Syncfusion.Blazor.Diagram.SymbolPalette
<div style="display: flex;">
<div style="width: 200px;">
<SfSymbolPaletteComponent @ref="_palette"
Height="600px"
Width="200px"
SymbolWidth="60"
SymbolHeight="60"
Palettes="@palettes"
SymbolDragPreviewSize="@symbolDragPreviewSize"
SymbolMargin="@symbolMargin">
</SfSymbolPaletteComponent>
</div>
<div style="flex: 1;">
<SfDiagramComponent @ref="_diagram" Height="600px" Width="100%" />
</div>
</div>
@code {
SfSymbolPaletteComponent _palette;
SfDiagramComponent _diagram;
private DiagramSize symbolDragPreviewSize;
DiagramObjectCollection<Palette> palettes = new();
SymbolMargin symbolMargin = new SymbolMargin { Left = 15, Right = 15, Top = 15, Bottom = 15 };
}
```
---
## Drag Preview Size
Control the size of the ghost element rendered while dragging a symbol onto the diagram canvas using `SymbolDragPreviewSize` on `SfSymbolPaletteComponent`. Set it in `OnInitialized` before the palette renders.
```razor
<SfSymbolPaletteComponent @ref="_palette"
Height="600px"
Width="200px"
SymbolWidth="60"
SymbolHeight="60"
Palettes="@palettes"
SymbolDragPreviewSize="@symbolDragPreviewSize"
SymbolMargin="@symbolMargin">
</SfSymbolPaletteComponent>
@code {
private DiagramSize symbolDragPreviewSize;
protected override void OnInitialized()
{
symbolDragPreviewSize = new DiagramSize();
symbolDragPreviewSize.Width = 160;
symbolDragPreviewSize.Height = 160;
}
}
```
### Sizing guidance
| Symbol type | Recommended size |
|---|---|
| Basic / flow shapes | `Width = 100, Height = 100` |
| UML classifier nodes (class, interface, enum) | `Width = 200, Height = 100` |
| Connector / relationship symbols | `Width = 150, Height = 60` |
| BPMN shapes | `Width = 100, Height = 100` |
> If `SymbolDragPreviewSize` is omitted, the drag ghost falls back to a small default that may clip complex symbols (e.g. UML classifiers) during drag.
---
## Adding Nodes to Palette
```razor
@code {
protected override void OnInitialized()
{
symbolDragPreviewSize = new DiagramSize();
symbolDragPreviewSize.Width = 160;
symbolDragPreviewSize.Height = 160;
var flowShapes = new DiagramObjectCollection<NodeBase>();
flowShapes.Add(new Node
{
ID = "Terminator",
Shape = new FlowShape { Type = NodeShapes.Flow, Shape = NodeFlowShapes.Terminator },
Style = new ShapeStyle { Fill = "#6495ED", StrokeColor = "#757575" }
});
flowShapes.Add(new Node
{
ID = "Process",
Shape = new FlowShape { Type = NodeShapes.Flow, Shape = NodeFlowShapes.Process },
Style = new ShapeStyle { Fill = "#6495ED", StrokeColor = "#757575" }
});
flowShapes.Add(new Node
{
ID = "Decision",
Shape = new FlowShape { Type = NodeShapes.Flow, Shape = NodeFlowShapes.Decision },
Style = new ShapeStyle { Fill = "#FFD700", StrokeColor = "#757575" }
});
palettes.Add(new Palette
{
Symbols = flowShapes,
Title = "Flowchart Shapes",
IsExpanded = true
});
}
}
```
---
## Adding Connectors to Palette
```razor
@code {
protected override void OnInitialized()
{
var connectorSymbols = new DiagramObjectCollection<NodeBase>();
connectorSymbols.Add(new Connector
{
ID = "StraightLine",
Type = ConnectorSegmentType.Straight,
SourcePoint = new DiagramPoint { X = 0, Y = 0 },
TargetPoint = new DiagramPoint { X = 60, Y = 60 },
TargetDecorator = new DecoratorSettings { Shape = DecoratorShape.OpenArrow }
});
connectorSymbols.Add(new Connector
{
ID = "OrthogonalLine",
Type = ConnectorSegmentType.Orthogonal,
SourcePoint = new DiagramPoint { X = 0, Y = 0 },
TargetPoint = new DiagramPoint { X = 60, Y = 60 }
});
palettes.Add(new Palette
{
Symbols = connectorSymbols,
Title = "Connectors",
IsExpanded = true
});
}
}
```
---
## Multiple Palette Groups
Organize shapes into collapsible groups:
```razor
palettes = new DiagramObjectCollection<Palette>
{
new Palette { Symbols = flowShapes, Title = "Flow Shapes", IsExpanded = true },
new Palette { Symbols = basicShapes, Title = "Basic Shapes", IsExpanded = false },
new Palette { Symbols = bpmnShapes, Title = "BPMN", IsExpanded = false },
new Palette { Symbols = connectorSymbols, Title = "Connectors", IsExpanded = true }
};
```
---
## Linking Palette to Diagram
Link the palette to the diagram in `OnAfterRenderAsync` so drag-and-drop works:
```razor
<SfSymbolPaletteComponent @ref="_palette" />
<SfDiagramComponent @ref="_diagram" />
@code {
protected override async Task OnAfterRenderAsync(bool firstRender)
{
if (firstRender)
{
_palette.Targets = new DiagramObjectCollection<SfDiagramComponent> { _diagram };
}
}
}
```
> **This step is required** — without setting `Targets`, dragging from palette to diagram will not work.
---
## Custom Symbol Styling
Override how symbols look in the palette using `SymbolInfo`:
```razor
<SfSymbolPaletteComponent SymbolWidth="60" SymbolHeight="60"
GetSymbolInfo="GetSymbolInfo"
Palettes="@palettes">
</SfSymbolPaletteComponent>
@code {
private SymbolInfo GetSymbolInfo(IDiagramObject symbol)
{
return new SymbolInfo
{
Fit = true, // scale symbol to fit the cell
Description = new SymbolDescription
{
Text = (symbol as Node)?.ID ?? "",
}
};
}
}
```
---
## Common Gotchas
- **`_palette.Targets` must be set** in `OnAfterRenderAsync` — drag-and-drop won't work without it
- **Symbols use `DiagramObjectCollection<NodeBase>`** — not `DiagramObjectCollection<Node>`. Cast nodes/connectors as `NodeBase`
- **Symbol `ID` must be unique** across all palettes
- **`SymbolWidth`/`SymbolHeight`** control the size of symbols in the palette — not the size they drop as
- **`SymbolMargin`** adds padding around each symbol in the palette grid
- **Connectors in palette need `SourcePoint`/`TargetPoint`** defined even though they'll re-route when dropped
- **Namespace:** Palette requires `@using Syncfusion.Blazor.Diagram.SymbolPalette` in addition to `Syncfusion.Blazor.Diagram`
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 |