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/uml-sequence.md
View on GitHub# UML Sequence Diagram in Blazor Diagram
A UML sequence diagram shows how objects communicate in a time-ordered sequence. Use `UmlSequenceDiagramModel` instead of manually creating nodes/connectors.
---
## Basic Setup
```razor
@using Syncfusion.Blazor.Diagram
<SfDiagramComponent @ref="_diagram" Height="600px" Model="@_model" />
@code {
private SfDiagramComponent _diagram;
private UmlSequenceDiagramModel _model;
protected override void OnInitialized()
{
_model = new UmlSequenceDiagramModel
{
SpaceBetweenParticipants = 200,
Participants = new List<UmlSequenceParticipant>
{
new UmlSequenceParticipant { ID = "User", Content = "User", IsActor = true },
new UmlSequenceParticipant { ID = "System", Content = "System", IsActor = false }
},
Messages = new List<UmlSequenceMessage>
{
new UmlSequenceMessage
{
ID = "MSG1", Content = "Login Request",
FromParticipantID = "User", ToParticipantID = "System",
MessageType = UmlSequenceMessageType.Synchronous
},
new UmlSequenceMessage
{
ID = "MSG2", Content = "Login Response",
FromParticipantID = "System", ToParticipantID = "User",
MessageType = UmlSequenceMessageType.Reply
}
}
};
}
}
```
---
## Participants (Lifelines)
| Property | Type | Description |
|----------|------|-------------|
| `ID` | string | Unique identifier |
| `Content` | string | Display name |
| `IsActor` | bool | `true` = stick figure (actor); `false` = box (object/system) |
| `ShowDestructionMarker` | bool | Show X at the end of the lifeline |
| `ActivationBoxes` | `IEnumerable<UmlSequenceActivationBox>` | Active execution periods |
---
## Message Types
| `UmlSequenceMessageType` | Description |
|--------------------------|-------------|
| `Synchronous` | Solid arrow — sender waits for response |
| `Asynchronous` | Open arrow — sender continues immediately |
| `Reply` | Dashed arrow — response to a previous message |
| `Create` | Creates a new participant instance |
| `Delete` | Terminates a participant |
| `Self` | Arrow from participant to itself |
**UmlSequenceMessage properties:**
| Property | Type | Description |
|----------|------|-------------|
| `ID` | string | Unique identifier |
| `Content` | string | Label shown on the arrow |
| `FromParticipantID` | string | Sender participant ID |
| `ToParticipantID` | string | Receiver participant ID |
| `MessageType` | `UmlSequenceMessageType` | Arrow style and semantics |
---
## Activation Boxes
Show when a participant is actively processing (thin rectangle on lifeline):
```csharp
new UmlSequenceParticipant
{
ID = "System",
Content = "System",
ActivationBoxes = new List<UmlSequenceActivationBox>
{
new UmlSequenceActivationBox
{
ID = "Act1",
StartMessageID = "MSG1", // activation starts when MSG1 is received
EndMessageID = "MSG2" // activation ends when MSG2 is sent
}
}
}
```
---
## Fragments (Alt / Loop / Opt)
Fragments group messages under conditional or looping constructs:
```csharp
Fragments = new List<UmlSequenceFragment>
{
new UmlSequenceFragment
{
ID = "Frag1",
FragmentType = UmlSequenceFragmentType.Alternative,
Conditions = new List<UmlSequenceFragmentCondition>
{
new UmlSequenceFragmentCondition
{
Content = "if payment succeeds",
MessageIds = new List<string> { "MSG3", "MSG4" }
},
new UmlSequenceFragmentCondition
{
Content = "if payment fails",
MessageIds = new List<string> { "MSG5" }
}
}
}
}
```
### Fragment types:
| `UmlSequenceFragmentType` | Description |
|---------------------------|-------------|
| `Optional` | `opt` — executes only if condition is met |
| `Alternative` | `alt` — if/else branches |
| `Loop` | `loop` — repeating block |
### Nested fragments:
Use `Conditions[n].Fragments` to nest fragments inside a condition:
```csharp
new UmlSequenceFragmentCondition
{
Content = "while retries < 3",
Fragments = new List<UmlSequenceFragment> { innerFragment }
}
```
---
## Participant Spacing
```csharp
_model = new UmlSequenceDiagramModel
{
SpaceBetweenParticipants = 300, // default is 100
// ...
};
```
---
## Updating the Diagram After Model Changes (UpdateFromModelAsync)
After programmatically modifying the `UmlSequenceDiagramModel` (adding participants, messages, or fragments) at runtime, call `UpdateFromModelAsync()` to synchronize the diagram UI with the updated model:
```csharp
private async Task AddNewMessage()
{
// Modify the model — add a new message
_model.Messages.Add(new UmlSequenceMessage
{
ID = "MSG4",
Content = "New interaction",
FromParticipantID = "Client",
ToParticipantID = "Server",
MessageType = UmlSequenceMessageType.Synchronous
});
// Tell the diagram to refresh its visual representation
await _diagram.UpdateFromModelAsync();
}
private async Task AddNewParticipant()
{
_model.Participants.Add(new UmlSequenceParticipant
{
ID = "Database",
Content = "Database",
IsActor = false
});
await _diagram.UpdateFromModelAsync();
}
```
> **Note:** `UpdateFromModelAsync()` is required any time the `UmlSequenceDiagramModel` is changed at runtime — the diagram does NOT automatically re-render when you mutate the model object. Always `await` it.
---
## Common Gotchas
- **Set `Model` property** on `SfDiagramComponent` — do not use `Nodes`/`Connectors` for sequence diagrams
- **IDs must be unique** across participants and messages — duplicate IDs cause rendering issues
- **Message order matters** — messages are displayed top-to-bottom in the order they appear in `Messages`
- **`StartMessageID`/`EndMessageID`** on activation boxes must reference valid message IDs — mismatches silently fail
- **Fragments reference messages by ID** — a message can only belong to one fragment condition; cross-condition references are not supported
- **`SpaceBetweenParticipants`** should be increased when participant names or message labels are long
- **Serialization** — sequence diagram models created via `UmlSequenceDiagramModel` can be saved/loaded with `SaveDiagramAsMermaid` / `LoadDiagramFromMermaidAsync`
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 |