Syncfusion React Diagram
The Syncfusion React Diagram component enables building rich, interactive diagrams including flowcharts, organizational charts, BPMN process flows, UML diagrams, mind maps, and network diagrams. It renders using SVG and supports extensive customization through nodes, connectors, ports, annotations, layouts, and data binding.
Table of Contents
When to Use This Skill
Use this skill when users need to:
- Build flowcharts representing processes, decision trees, or workflows
- Create org charts from hierarchical or flat data sources
- Model BPMN diagrams with activities, events, gateways, and flows
- Draw UML diagrams including class diagrams and sequence diagrams
- Visualize mind maps or radial layouts from data
- Design network/entity diagrams with nodes and relationship connectors
- Implement swimlane diagrams with lanes and phases
- Drag and drop shapes from a symbol palette onto a canvas
- Bind data to automatically generate diagram structure
- Serialize and restore diagram state as JSON
- Export or print diagram content as image/SVG
Important: API Verification Required
API Verification Required: Always verify API class names, properties, and signatures by reading reference files (references/*.md) BEFORE generating code examples. Do not assume or infer class names.
Component Overview
The Diagram component is built around:
- Nodes — Graphical shapes (rectangles, circles, flow shapes, custom) placed on the canvas
- Connectors — Lines/arrows linking nodes or freestanding points
- Annotations — Text labels attached to nodes or connectors
- Ports — Named connection points on nodes for precise connector anchoring
- Layouts — Automatic arrangement algorithms (hierarchical, org-chart, mindmap, radial, flowchart)
- Symbol Palette — Sidebar of draggable shape symbols
- Module System — Opt-in feature modules (
Inject directive) to keep bundle size lean
All diagram elements are rendered using SVG for crisp, resolution-independent graphics.
Documentation and Navigation Guide
Getting Started
📄 Read: references/getting-started.md
When to read:
- First-time setup of the Diagram component
- Installing packages, CSS imports, and theme configuration
- Creating a minimal
DiagramComponent
- Understanding the
Inject module system
- Next.js or Preact integration
Covers:
- npm install and dependencies
- Vite/CRA project setup
- CSS theme import paths
- Basic
DiagramComponent with nodes and connectors
- Module injection with
<Inject services={[...]} />
- Next.js and Preact usage notes
Nodes
📄 Read: references/nodes.md
When to read:
- Adding, positioning, and sizing nodes
- Customizing node appearance (fill, stroke, shadow)
- Working with node shapes (Flow, Basic, Path, Image, HTML)
- Handling node events (click, drag, resize)
- Expanding/collapsing nodes at runtime
- Setting default node properties via
getNodeDefaults
Covers:
- Creating nodes via
nodes collection
offsetX/offsetY, width/height positioning
- Adding/removing nodes at runtime (
diagram.add, diagram.remove)
- Style properties (fill, strokeColor, opacity, gradient)
getNodeDefaults pattern for consistent styling
- Node expand/collapse with
expandIcon/collapseIcon
- Node interaction events
Connectors
📄 Read: references/connectors.md
When to read:
- Drawing lines/arrows between nodes or freestanding points
- Choosing connector type (Straight, Orthogonal, Bezier)
- Configuring connector segments and routing
- Customizing decorator (arrow) shapes
- Setting
sourceID/targetID to link nodes
- Setting
getConnectorDefaults for consistent styling
Covers:
- Connector types:
Straight, Orthogonal, Bezier
sourcePoint/targetPoint for freestanding connectors
sourceID/targetID for node-to-node connections
- Multiple segment configuration
- Bezier control points and segment edit orientation
- Arrow/decorator customization
- Connector events and interaction
getConnectorDefaults pattern
Labels and Annotations
📄 Read: references/labels-and-annotations.md
When to read:
- Adding text labels to nodes or connectors
- Styling annotation text (font, color, bold, alignment)
- Making labels draggable or editable
- Positioning labels relative to nodes/connectors
- Handling label-specific events
Covers:
annotations array on nodes and connectors
- Label
content, style, offset, alignment
- Node labels vs. connector labels
- Label interaction (edit on double-click, drag)
- Label appearance (background, border, padding)
- Label events
Ports
📄 Read: references/ports.md
When to read:
- Creating named connection points on nodes
- Controlling where connectors attach to a node
- Styling and positioning ports
- Restricting connector connections to specific ports
- Handling port interaction events
Covers:
- Port types and
ports array on nodes
- Port positioning (
offset, alignment)
- Port appearance (shape, fill, stroke)
- Connecting connectors to specific ports via
sourcePortID/targetPortID
- Port interaction and visibility options
- Port events
Shapes and Styles
📄 Read: references/shapes-and-styles.md
When to read:
- Choosing the right shape type (Flow, Basic, Path, Image, HTML, Native SVG)
- Applying fill colors, gradients, and stroke styles
- Customizing node appearance with CSS or themes
- Understanding shape property structure
Covers:
shape.type options: Flow, Basic, Path, Image, HTML, Native
- Flowchart shape values (Terminator, Process, Decision, etc.)
- Basic shape values (Rectangle, Ellipse, Diamond, etc.)
- Style properties:
fill, strokeColor, strokeWidth, strokeDashArray, opacity
- Linear and radial gradients
- Shadow effect
- CSS class-based styling
BPMN Diagrams
📄 Read: references/bpmn-diagrams.md
When to read:
- Modeling business process flows using BPMN notation
- Using BPMN-specific shapes (activities, events, gateways)
- Drawing sequence flows, message flows, associations
- Adding data objects, data sources, text annotations, and groups
Covers:
BpmnDiagrams module injection
- BPMN shape type:
shape.type = 'Bpmn'
- Activities: Task types, Subprocess, Expanded Subprocess
- Events: Start, End, Intermediate events and their triggers
- Gateways: Exclusive, Parallel, Inclusive, Complex
- Flows: Sequence, Message, Association
- Data objects and data sources
- BPMN groups and text annotations
UML Diagrams
📄 Read: references/uml-diagrams.md
When to read:
- Building UML class diagrams with attributes and methods
- Modeling relationships (association, generalization, dependency)
- Creating UML sequence diagrams with lifelines and messages
- Working with classifiers (class, interface, enumeration, collaboration)
Covers:
- UML class diagram shapes (
shape.type = 'UmlClassifier')
- Classifier types: Class, Interface, Enumeration, Collaboration
- Attributes, operations, and members syntax
- UML relationship connector types
- UML sequence diagram (
shape.type = 'UmlActivity')
- Lifelines, messages, and fragments
ER Diagrams
📄 Read: references/entity-relationship-diagrams.md
When to read:
- Building Entity Relationship diagrams to visualize database structure
- Creating ER entity nodes representing database tables with fields
- Defining field properties (primary key, foreign key, data type, constraints)
- Adding or removing entity fields at runtime
- Connecting entities with ER relationship connectors and multiplicity
- Styling ER entity headers, field rows, and alternating row colors
- Tracking entity field changes via events
Covers:
ErDiagrams module injection (Diagram.Inject(ErDiagrams))
- ER entity node:
shape.type = 'Er' with ErShapeModel
- Header configuration:
annotation, height, style
- Field configuration:
id, name, dataType, isPrimaryKey, isForeignKey, constraints
addErField / removeErField runtime methods
fieldDefaults: alternateRowColors, height
- Field-level and node-level style overrides
erEntityChanged event for tracking field modifications
- ER relationship connectors with
ErConnectorShapeModel
- Crow's Foot multiplicity:
One, Many, ZeroOrOne, OneOrMany, ZeroOrMany, OneAndOnlyOne
Layouts
📄 Read: references/layouts.md
When to read:
- Automatically arranging nodes in a tree, hierarchy, or radial pattern
- Creating org charts driven by parent-child data
- Building mind maps from data sources
- Configuring flowchart layouts with decision/process shapes
- Customizing layout spacing, orientation, and alignment
Covers:
HierarchicalTree — top-down/left-right tree layouts
OrganizationalChart — classic org chart with getNodeDefaults/getConnectorDefaults
MindMap — branching mind map layout
RadialTree — circular radial layout
Flowchart layout (automatic flow arrangement)
ComplexHierarchicalTree for multi-parent hierarchies
layout property: type, orientation, margin, horizontalSpacing, verticalSpacing
LayoutAnimation module
- Layout events
Swimlanes
📄 Read: references/swimlanes.md
When to read:
- Creating multi-lane process diagrams
- Adding phases to represent timeline or stages
- Configuring swimlane headers and orientation
- Placing child nodes inside lanes
- Using swimlane shapes from the symbol palette
Covers:
- Swimlane
shape.type = 'SwimLane'
- Lanes and phases configuration
- Header text, size, and orientation
- Child nodes inside lanes
- Swimlane palette integration
- Swimlane interaction (add/remove lanes)
Groups and Containers
📄 Read: references/groups-and-containers.md
When to read:
- Grouping multiple nodes for collective movement/selection
- Adding/removing children from groups at runtime
- Using container nodes to visually bound child nodes
- Configuring padding, fit-to-children behavior
Covers:
- Group node
shape.type = 'Group' and children array
- Grouping/ungrouping nodes via diagram methods
- Adding children at runtime
- Container node configuration
- Padding and auto-fit behavior for containers
Symbol Palette
📄 Read: references/symbol-palette.md
When to read:
- Adding a drag-and-drop shape sidebar to your diagram app
- Defining custom symbol sets (palettes)
- Customizing palette icon size, search behavior, and accordion
- Handling
symbolDragEnter/symbolDrop events
Covers:
SymbolPaletteComponent setup alongside DiagramComponent
- Defining
palettes with symbol arrays
getSymbolInfo for display customization
- Palette accordion: expanding/collapsing groups
- Search functionality
- Symbol preview size configuration
- Palette events
Data Binding
📄 Read: references/data-binding.md
When to read:
- Generating diagrams automatically from JSON or remote data
- Mapping
id and parentId fields for hierarchy
- Using
DataManager for remote or filtered data
- Customizing node appearance based on data properties (
setNodeTemplate)
- Connecting to a PostgreSQL or external data source
Covers:
dataSourceSettings property
id, parentId field mapping
DataManager with local arrays or remote URLs
getNodeDefaults and setNodeTemplate for data-driven styling
- PostgreSQL data source integration
- Rendering org charts from flat JSON data
Interaction and Tools
📄 Read: references/interaction-and-tools.md
When to read:
- Enabling/disabling node and connector interactions (drag, resize, select)
- Switching diagram tool modes (pointer, draw, pan)
- Configuring diagram constraints
- Adding custom keyboard commands or toolbar actions
- Implementing undo/redo
- Setting up context menus or user handles
Covers:
DiagramConstraints, NodeConstraints, ConnectorConstraints
tool property: DiagramTools.Default, ZoomPan, DrawOnce
- Selection, drag, resize, rotate interactions
commands for keyboard shortcuts
- Undo/Redo (
UndoRedo module)
- Context menu (
DiagramContextMenu module)
- User handles for custom action buttons on nodes
Snapping module and snap settings
Serialization and Export
📄 Read: references/serialization-and-export.md
When to read:
- Saving and restoring diagram state as JSON
- Exporting the diagram as PNG, JPEG, or SVG
- Printing diagram content
- Importing Visio (.vsdx) files
- Migrating from EJ1 diagram format
Covers:
diagram.saveDiagram() and diagram.loadDiagram(json)
PrintAndExport module injection
- Export settings: format, region, margin, background
- Print dialog and options
- Visio file import (
visio.md)
- EJ1 serialization compatibility (
Ej1Serialization module)
Diagram Settings
📄 Read: references/diagram-settings.md
When to read:
- Managing diagram layers (visibility, locking, ordering)
- Enabling virtualization for performance with large diagrams
- Configuring grid lines, snapping, and rulers
- Setting page size, orientation, and margins
- Configuring scroll behavior and limits
- Adding tooltips to diagram elements
- Using the Overview component for minimap navigation
- Enabling localization or RTL support
- Understanding accessibility features
Covers:
- Layers: add, lock, set visibility, active layer
Virtualization module for large diagrams
- Grid lines: dots, lines, snap settings
- Ruler configuration
scrollSettings: scrollLimit, minZoom, maxZoom
pageSettings: size, orientation, background, multiplePage
- Tooltip on nodes and connectors
OverviewComponent minimap setup
- Localization and RTL
- ARIA and keyboard accessibility
Quick Start Example
Minimal Flowchart
import { DiagramComponent, NodeModel, ConnectorModel, Inject, UndoRedo } from '@syncfusion/ej2-react-diagrams';
const nodes: NodeModel[] = [
{ id: 'start', offsetX: 300, offsetY: 80, width: 140, height: 50,
shape: { type: 'Flow', shape: 'Terminator' }, annotations: [{ content: 'Start' }] },
{ id: 'process', offsetX: 300, offsetY: 180, width: 140, height: 50,
shape: { type: 'Flow', shape: 'Process' }, annotations: [{ content: 'Process' }] },
{ id: 'end', offsetX: 300, offsetY: 290, width: 140, height: 50,
shape: { type: 'Flow', shape: 'Terminator' }, annotations: [{ content: 'End' }] },
];
const connectors: ConnectorModel[] = [
{ id: 'c1', sourceID: 'start', targetID: 'process' },
{ id: 'c2', sourceID: 'process', targetID: 'end' },
];
export default function App() {
return (
<DiagramComponent id="diagram" width={'100%'} height={'500px'}
nodes={nodes} connectors={connectors}
getConnectorDefaults={(obj) => { obj.type = 'Orthogonal'; return obj; }}>
<Inject services={[UndoRedo]} />
</DiagramComponent>
);
}
CSS import: @import '@syncfusion/ej2-react-diagrams/styles/material.css'; and peer CSS for ej2-base, ej2-popups, ej2-splitbuttons, ej2-navigations.
Common Patterns
Pattern 1: Org Chart from Data Source
import { DiagramComponent, HierarchicalTree, DataBinding, Inject } from '@syncfusion/ej2-react-diagrams';
import { DataManager } from '@syncfusion/ej2-data';
const data = [
{ Name: 'CEO' },
{ Name: 'CTO', ReportingPerson: 'CEO' },
{ Name: 'Dev Lead', ReportingPerson: 'CTO' },
];
export default function App() {
return (
<DiagramComponent id="diagram" width={'100%'} height={'500px'}
dataSourceSettings={{ id: 'Name', parentId: 'ReportingPerson', dataManager: new DataManager(data) }}
layout={{ type: 'OrganizationalChart' }}
getNodeDefaults={(node) => { node.width = 120; node.height = 40; return node; }}
getConnectorDefaults={(obj) => { obj.type = 'Orthogonal'; return obj; }}>
<Inject services={[DataBinding, HierarchicalTree]} />
</DiagramComponent>
);
}
Pattern 2: Save and Load Diagram State
Use diagramInstance.saveDiagram() to serialize to JSON string; diagramInstance.loadDiagram(json) to restore. Inject UndoRedo for history support. For full examples see references/serialization-and-export.md.
Pattern 3: Diagram with Symbol Palette
Render SymbolPaletteComponent alongside DiagramComponent. Define palettes with shape arrays, set symbolHeight/symbolWidth, and users can drag shapes onto the canvas. For full examples see references/symbol-palette.md.
Module Injection Reference
Inject only the modules your diagram uses: <Inject services={[HierarchicalTree, DataBinding, UndoRedo]} />
| Module |
Purpose |
HierarchicalTree |
Tree and org chart layouts |
MindMap |
Mind map layout |
RadialTree |
Radial/circular layout |
ComplexHierarchicalTree |
Multi-parent hierarchies |
DataBinding |
Data source integration |
UndoRedo |
Undo/redo history |
Snapping |
Grid snapping |
PrintAndExport |
Export & print |
BpmnDiagrams |
BPMN shapes |
ErDiagrams |
ER diagram shapes and relationships |
LayoutAnimation |
Animated layouts |
DiagramContextMenu |
Right-click context menu |
ConnectorBridging |
Bridge overlapping connectors |
ConnectorEditing |
Edit connector segments |
Ej1Serialization |
Load EJ1 diagram JSON |
Key Props
| Prop |
Type |
Description |
nodes |
NodeModel[] |
Array of node definitions |
connectors |
ConnectorModel[] |
Array of connector definitions |
layout |
LayoutModel |
Automatic layout configuration |
dataSourceSettings |
DataSourceModel |
Data source for auto-generated diagrams |
getNodeDefaults |
(node) => NodeModel |
Default properties for all nodes |
getConnectorDefaults |
(obj) => ConnectorModel |
Default properties for all connectors |
setNodeTemplate |
(node) => DiagramElement |
Custom template rendering for nodes |
tool |
DiagramTools |
Active interaction tool mode |
snapSettings |
SnapSettingsModel |
Grid and snap configuration |
scrollSettings |
ScrollSettingsModel |
Scroll limits and zoom bounds |
pageSettings |
PageSettingsModel |
Page size, orientation, background |
constraints |
DiagramConstraints |
Enable/disable diagram-level interactions |
width |
string |
Diagram canvas width (e.g., '100%') |
height |
string |
Diagram canvas height (e.g., '600px') |
Related Components
- Chart - Data-driven charts and graphs
- Kanban - Kanban board visualization
- Data Grid - Tabular data display
1---
2name: syncfusion-react-diagram
3description: Create and customize visual diagrams in React using Syncfusion Diagrams. Trigger for requests involving React component setup, nodes and connectors, flowcharts, org charts, process diagrams, BPMN or UML models, ER diagrams, layout algorithms, swimlanes, symbol palettes, and interactive diagram visualization features.
4metadata:
5 author: "Syncfusion Inc"
6 version: "34.1.29"
7 category: "Data Visualization"
8---
9
10# Syncfusion React Diagram
11
12The Syncfusion React Diagram component enables building rich, interactive diagrams including flowcharts, organizational charts, BPMN process flows, UML diagrams, mind maps, and network diagrams. It renders using SVG and supports extensive customization through nodes, connectors, ports, annotations, layouts, and data binding.
13
14## Table of Contents
15- [When to Use This Skill](#when-to-use-this-skill)
16- [Component Overview](#component-overview)
17- [Documentation and Navigation Guide](#documentation-and-navigation-guide)
18 - [Getting Started](#getting-started)
19 - [Nodes](#nodes)
20 - [Connectors](#connectors)
21 - [Labels and Annotations](#labels-and-annotations)
22 - [Ports](#ports)
23 - [Shapes and Styles](#shapes-and-styles)
24 - [BPMN Diagrams](#bpmn-diagrams)
25 - [UML Diagrams](#uml-diagrams)
26 - [ER Diagrams](#er-diagrams)
27 - [Layouts](#layouts)
28 - [Swimlanes](#swimlanes)
29 - [Groups and Containers](#groups-and-containers)
30 - [Symbol Palette](#symbol-palette)
31 - [Data Binding](#data-binding)
32 - [Interaction and Tools](#interaction-and-tools)
33 - [Serialization and Export](#serialization-and-export)
34 - [Diagram Settings](#diagram-settings)
35- [Quick Start Example](#quick-start-example)
36- [Common Patterns](#common-patterns)
37- [Module Injection Reference](#module-injection-reference)
38- [Key Props](#key-props)
39
40## When to Use This Skill
41
42Use this skill when users need to:
43
44- **Build flowcharts** representing processes, decision trees, or workflows
45- **Create org charts** from hierarchical or flat data sources
46- **Model BPMN diagrams** with activities, events, gateways, and flows
47- **Draw UML diagrams** including class diagrams and sequence diagrams
48- **Visualize mind maps** or radial layouts from data
49- **Design network/entity diagrams** with nodes and relationship connectors
50- **Implement swimlane diagrams** with lanes and phases
51- **Drag and drop shapes** from a symbol palette onto a canvas
52- **Bind data** to automatically generate diagram structure
53- **Serialize and restore** diagram state as JSON
54- **Export or print** diagram content as image/SVG
55
56## Important: API Verification Required
57
58**API Verification Required**: Always verify API class names, properties, and signatures by reading reference files (`references/*.md`) BEFORE generating code examples. Do not assume or infer class names.
59
60## Component Overview
61
62The Diagram component is built around:
63
64- **Nodes** — Graphical shapes (rectangles, circles, flow shapes, custom) placed on the canvas
65- **Connectors** — Lines/arrows linking nodes or freestanding points
66- **Annotations** — Text labels attached to nodes or connectors
67- **Ports** — Named connection points on nodes for precise connector anchoring
68- **Layouts** — Automatic arrangement algorithms (hierarchical, org-chart, mindmap, radial, flowchart)
69- **Symbol Palette** — Sidebar of draggable shape symbols
70- **Module System** — Opt-in feature modules (`Inject` directive) to keep bundle size lean
71
72All diagram elements are rendered using **SVG** for crisp, resolution-independent graphics.
73
74## Documentation and Navigation Guide
75
76### Getting Started
77
78📄 **Read:** [references/getting-started.md](references/getting-started.md)
79
80**When to read:**
81- First-time setup of the Diagram component
82- Installing packages, CSS imports, and theme configuration
83- Creating a minimal `DiagramComponent`
84- Understanding the `Inject` module system
85- Next.js or Preact integration
86
87**Covers:**
88- npm install and dependencies
89- Vite/CRA project setup
90- CSS theme import paths
91- Basic `DiagramComponent` with `nodes` and `connectors`
92- Module injection with `<Inject services={[...]} />`
93- Next.js and Preact usage notes
94
95---
96
97### Nodes
98
99📄 **Read:** [references/nodes.md](references/nodes.md)
100
101**When to read:**
102- Adding, positioning, and sizing nodes
103- Customizing node appearance (fill, stroke, shadow)
104- Working with node shapes (Flow, Basic, Path, Image, HTML)
105- Handling node events (click, drag, resize)
106- Expanding/collapsing nodes at runtime
107- Setting default node properties via `getNodeDefaults`
108
109**Covers:**
110- Creating nodes via `nodes` collection
111- `offsetX`/`offsetY`, `width`/`height` positioning
112- Adding/removing nodes at runtime (`diagram.add`, `diagram.remove`)
113- Style properties (fill, strokeColor, opacity, gradient)
114- `getNodeDefaults` pattern for consistent styling
115- Node expand/collapse with `expandIcon`/`collapseIcon`
116- Node interaction events
117
118---
119
120### Connectors
121
122📄 **Read:** [references/connectors.md](references/connectors.md)
123
124**When to read:**
125- Drawing lines/arrows between nodes or freestanding points
126- Choosing connector type (Straight, Orthogonal, Bezier)
127- Configuring connector segments and routing
128- Customizing decorator (arrow) shapes
129- Setting `sourceID`/`targetID` to link nodes
130- Setting `getConnectorDefaults` for consistent styling
131
132**Covers:**
133- Connector types: `Straight`, `Orthogonal`, `Bezier`
134- `sourcePoint`/`targetPoint` for freestanding connectors
135- `sourceID`/`targetID` for node-to-node connections
136- Multiple segment configuration
137- Bezier control points and segment edit orientation
138- Arrow/decorator customization
139- Connector events and interaction
140- `getConnectorDefaults` pattern
141
142---
143
144### Labels and Annotations
145
146📄 **Read:** [references/labels-and-annotations.md](references/labels-and-annotations.md)
147
148**When to read:**
149- Adding text labels to nodes or connectors
150- Styling annotation text (font, color, bold, alignment)
151- Making labels draggable or editable
152- Positioning labels relative to nodes/connectors
153- Handling label-specific events
154
155**Covers:**
156- `annotations` array on nodes and connectors
157- Label `content`, `style`, `offset`, `alignment`
158- Node labels vs. connector labels
159- Label interaction (edit on double-click, drag)
160- Label appearance (background, border, padding)
161- Label events
162
163---
164
165### Ports
166
167📄 **Read:** [references/ports.md](references/ports.md)
168
169**When to read:**
170- Creating named connection points on nodes
171- Controlling where connectors attach to a node
172- Styling and positioning ports
173- Restricting connector connections to specific ports
174- Handling port interaction events
175
176**Covers:**
177- Port types and `ports` array on nodes
178- Port positioning (`offset`, `alignment`)
179- Port appearance (shape, fill, stroke)
180- Connecting connectors to specific ports via `sourcePortID`/`targetPortID`
181- Port interaction and visibility options
182- Port events
183
184---
185
186### Shapes and Styles
187
188📄 **Read:** [references/shapes-and-styles.md](references/shapes-and-styles.md)
189
190**When to read:**
191- Choosing the right shape type (Flow, Basic, Path, Image, HTML, Native SVG)
192- Applying fill colors, gradients, and stroke styles
193- Customizing node appearance with CSS or themes
194- Understanding shape property structure
195
196**Covers:**
197- `shape.type` options: `Flow`, `Basic`, `Path`, `Image`, `HTML`, `Native`
198- Flowchart shape values (Terminator, Process, Decision, etc.)
199- Basic shape values (Rectangle, Ellipse, Diamond, etc.)
200- Style properties: `fill`, `strokeColor`, `strokeWidth`, `strokeDashArray`, `opacity`
201- Linear and radial gradients
202- Shadow effect
203- CSS class-based styling
204
205---
206
207### BPMN Diagrams
208
209📄 **Read:** [references/bpmn-diagrams.md](references/bpmn-diagrams.md)
210
211**When to read:**
212- Modeling business process flows using BPMN notation
213- Using BPMN-specific shapes (activities, events, gateways)
214- Drawing sequence flows, message flows, associations
215- Adding data objects, data sources, text annotations, and groups
216
217**Covers:**
218- `BpmnDiagrams` module injection
219- BPMN shape type: `shape.type = 'Bpmn'`
220- Activities: Task types, Subprocess, Expanded Subprocess
221- Events: Start, End, Intermediate events and their triggers
222- Gateways: Exclusive, Parallel, Inclusive, Complex
223- Flows: Sequence, Message, Association
224- Data objects and data sources
225- BPMN groups and text annotations
226
227---
228
229### UML Diagrams
230
231📄 **Read:** [references/uml-diagrams.md](references/uml-diagrams.md)
232
233**When to read:**
234- Building UML class diagrams with attributes and methods
235- Modeling relationships (association, generalization, dependency)
236- Creating UML sequence diagrams with lifelines and messages
237- Working with classifiers (class, interface, enumeration, collaboration)
238
239**Covers:**
240- UML class diagram shapes (`shape.type = 'UmlClassifier'`)
241- Classifier types: Class, Interface, Enumeration, Collaboration
242- Attributes, operations, and members syntax
243- UML relationship connector types
244- UML sequence diagram (`shape.type = 'UmlActivity'`)
245- Lifelines, messages, and fragments
246
247---
248
249### ER Diagrams
250
251📄 **Read:** [references/entity-relationship-diagrams.md](references/entity-relationship-diagrams.md)
252
253**When to read:**
254- Building Entity Relationship diagrams to visualize database structure
255- Creating ER entity nodes representing database tables with fields
256- Defining field properties (primary key, foreign key, data type, constraints)
257- Adding or removing entity fields at runtime
258- Connecting entities with ER relationship connectors and multiplicity
259- Styling ER entity headers, field rows, and alternating row colors
260- Tracking entity field changes via events
261
262**Covers:**
263- `ErDiagrams` module injection (`Diagram.Inject(ErDiagrams)`)
264- ER entity node: `shape.type = 'Er'` with `ErShapeModel`
265- Header configuration: `annotation`, `height`, `style`
266- Field configuration: `id`, `name`, `dataType`, `isPrimaryKey`, `isForeignKey`, `constraints`
267- `addErField` / `removeErField` runtime methods
268- `fieldDefaults`: `alternateRowColors`, `height`
269- Field-level and node-level style overrides
270- `erEntityChanged` event for tracking field modifications
271- ER relationship connectors with `ErConnectorShapeModel`
272- Crow's Foot multiplicity: `One`, `Many`, `ZeroOrOne`, `OneOrMany`, `ZeroOrMany`, `OneAndOnlyOne`
273
274---
275
276### Layouts
277
278📄 **Read:** [references/layouts.md](references/layouts.md)
279
280**When to read:**
281- Automatically arranging nodes in a tree, hierarchy, or radial pattern
282- Creating org charts driven by parent-child data
283- Building mind maps from data sources
284- Configuring flowchart layouts with decision/process shapes
285- Customizing layout spacing, orientation, and alignment
286
287**Covers:**
288- `HierarchicalTree` — top-down/left-right tree layouts
289- `OrganizationalChart` — classic org chart with `getNodeDefaults`/`getConnectorDefaults`
290- `MindMap` — branching mind map layout
291- `RadialTree` — circular radial layout
292- `Flowchart` layout (automatic flow arrangement)
293- `ComplexHierarchicalTree` for multi-parent hierarchies
294- `layout` property: `type`, `orientation`, `margin`, `horizontalSpacing`, `verticalSpacing`
295- `LayoutAnimation` module
296- Layout events
297
298---
299
300### Swimlanes
301
302📄 **Read:** [references/swimlanes.md](references/swimlanes.md)
303
304**When to read:**
305- Creating multi-lane process diagrams
306- Adding phases to represent timeline or stages
307- Configuring swimlane headers and orientation
308- Placing child nodes inside lanes
309- Using swimlane shapes from the symbol palette
310
311**Covers:**
312- Swimlane `shape.type = 'SwimLane'`
313- Lanes and phases configuration
314- Header text, size, and orientation
315- Child nodes inside lanes
316- Swimlane palette integration
317- Swimlane interaction (add/remove lanes)
318
319---
320
321### Groups and Containers
322
323📄 **Read:** [references/groups-and-containers.md](references/groups-and-containers.md)
324
325**When to read:**
326- Grouping multiple nodes for collective movement/selection
327- Adding/removing children from groups at runtime
328- Using container nodes to visually bound child nodes
329- Configuring padding, fit-to-children behavior
330
331**Covers:**
332- Group node `shape.type = 'Group'` and `children` array
333- Grouping/ungrouping nodes via diagram methods
334- Adding children at runtime
335- Container node configuration
336- Padding and auto-fit behavior for containers
337
338---
339
340### Symbol Palette
341
342📄 **Read:** [references/symbol-palette.md](references/symbol-palette.md)
343
344**When to read:**
345- Adding a drag-and-drop shape sidebar to your diagram app
346- Defining custom symbol sets (palettes)
347- Customizing palette icon size, search behavior, and accordion
348- Handling `symbolDragEnter`/`symbolDrop` events
349
350**Covers:**
351- `SymbolPaletteComponent` setup alongside `DiagramComponent`
352- Defining `palettes` with symbol arrays
353- `getSymbolInfo` for display customization
354- Palette accordion: expanding/collapsing groups
355- Search functionality
356- Symbol preview size configuration
357- Palette events
358
359---
360
361### Data Binding
362
363📄 **Read:** [references/data-binding.md](references/data-binding.md)
364
365**When to read:**
366- Generating diagrams automatically from JSON or remote data
367- Mapping `id` and `parentId` fields for hierarchy
368- Using `DataManager` for remote or filtered data
369- Customizing node appearance based on data properties (`setNodeTemplate`)
370- Connecting to a PostgreSQL or external data source
371
372**Covers:**
373- `dataSourceSettings` property
374- `id`, `parentId` field mapping
375- `DataManager` with local arrays or remote URLs
376- `getNodeDefaults` and `setNodeTemplate` for data-driven styling
377- PostgreSQL data source integration
378- Rendering org charts from flat JSON data
379
380---
381
382### Interaction and Tools
383
384📄 **Read:** [references/interaction-and-tools.md](references/interaction-and-tools.md)
385
386**When to read:**
387- Enabling/disabling node and connector interactions (drag, resize, select)
388- Switching diagram tool modes (pointer, draw, pan)
389- Configuring diagram constraints
390- Adding custom keyboard commands or toolbar actions
391- Implementing undo/redo
392- Setting up context menus or user handles
393
394**Covers:**
395- `DiagramConstraints`, `NodeConstraints`, `ConnectorConstraints`
396- `tool` property: `DiagramTools.Default`, `ZoomPan`, `DrawOnce`
397- Selection, drag, resize, rotate interactions
398- `commands` for keyboard shortcuts
399- Undo/Redo (`UndoRedo` module)
400- Context menu (`DiagramContextMenu` module)
401- User handles for custom action buttons on nodes
402- `Snapping` module and snap settings
403
404---
405
406### Serialization and Export
407
408📄 **Read:** [references/serialization-and-export.md](references/serialization-and-export.md)
409
410**When to read:**
411- Saving and restoring diagram state as JSON
412- Exporting the diagram as PNG, JPEG, or SVG
413- Printing diagram content
414- Importing Visio (.vsdx) files
415- Migrating from EJ1 diagram format
416
417**Covers:**
418- `diagram.saveDiagram()` and `diagram.loadDiagram(json)`
419- `PrintAndExport` module injection
420- Export settings: format, region, margin, background
421- Print dialog and options
422- Visio file import (`visio.md`)
423- EJ1 serialization compatibility (`Ej1Serialization` module)
424
425---
426
427### Diagram Settings
428
429📄 **Read:** [references/diagram-settings.md](references/diagram-settings.md)
430
431**When to read:**
432- Managing diagram layers (visibility, locking, ordering)
433- Enabling virtualization for performance with large diagrams
434- Configuring grid lines, snapping, and rulers
435- Setting page size, orientation, and margins
436- Configuring scroll behavior and limits
437- Adding tooltips to diagram elements
438- Using the Overview component for minimap navigation
439- Enabling localization or RTL support
440- Understanding accessibility features
441
442**Covers:**
443- Layers: add, lock, set visibility, active layer
444- `Virtualization` module for large diagrams
445- Grid lines: dots, lines, snap settings
446- Ruler configuration
447- `scrollSettings`: `scrollLimit`, `minZoom`, `maxZoom`
448- `pageSettings`: size, orientation, background, multiplePage
449- Tooltip on nodes and connectors
450- `OverviewComponent` minimap setup
451- Localization and RTL
452- ARIA and keyboard accessibility
453
454---
455
456## Quick Start Example
457
458### Minimal Flowchart
459
460```tsx
461import { DiagramComponent, NodeModel, ConnectorModel, Inject, UndoRedo } from '@syncfusion/ej2-react-diagrams';
462
463const nodes: NodeModel[] = [
464 { id: 'start', offsetX: 300, offsetY: 80, width: 140, height: 50,
465 shape: { type: 'Flow', shape: 'Terminator' }, annotations: [{ content: 'Start' }] },
466 { id: 'process', offsetX: 300, offsetY: 180, width: 140, height: 50,
467 shape: { type: 'Flow', shape: 'Process' }, annotations: [{ content: 'Process' }] },
468 { id: 'end', offsetX: 300, offsetY: 290, width: 140, height: 50,
469 shape: { type: 'Flow', shape: 'Terminator' }, annotations: [{ content: 'End' }] },
470];
471const connectors: ConnectorModel[] = [
472 { id: 'c1', sourceID: 'start', targetID: 'process' },
473 { id: 'c2', sourceID: 'process', targetID: 'end' },
474];
475
476export default function App() {
477 return (
478 <DiagramComponent id="diagram" width={'100%'} height={'500px'}
479 nodes={nodes} connectors={connectors}
480 getConnectorDefaults={(obj) => { obj.type = 'Orthogonal'; return obj; }}>
481 <Inject services={[UndoRedo]} />
482 </DiagramComponent>
483 );
484}
485```
486
487CSS import: `@import '@syncfusion/ej2-react-diagrams/styles/material.css';` and peer CSS for `ej2-base`, `ej2-popups`, `ej2-splitbuttons`, `ej2-navigations`.
488
489---
490
491## Common Patterns
492
493### Pattern 1: Org Chart from Data Source
494
495```tsx
496import { DiagramComponent, HierarchicalTree, DataBinding, Inject } from '@syncfusion/ej2-react-diagrams';
497import { DataManager } from '@syncfusion/ej2-data';
498
499const data = [
500 { Name: 'CEO' },
501 { Name: 'CTO', ReportingPerson: 'CEO' },
502 { Name: 'Dev Lead', ReportingPerson: 'CTO' },
503];
504
505export default function App() {
506 return (
507 <DiagramComponent id="diagram" width={'100%'} height={'500px'}
508 dataSourceSettings={{ id: 'Name', parentId: 'ReportingPerson', dataManager: new DataManager(data) }}
509 layout={{ type: 'OrganizationalChart' }}
510 getNodeDefaults={(node) => { node.width = 120; node.height = 40; return node; }}
511 getConnectorDefaults={(obj) => { obj.type = 'Orthogonal'; return obj; }}>
512 <Inject services={[DataBinding, HierarchicalTree]} />
513 </DiagramComponent>
514 );
515}
516```
517
518### Pattern 2: Save and Load Diagram State
519
520Use `diagramInstance.saveDiagram()` to serialize to JSON string; `diagramInstance.loadDiagram(json)` to restore. Inject `UndoRedo` for history support. For full examples see [references/serialization-and-export.md](references/serialization-and-export.md).
521
522### Pattern 3: Diagram with Symbol Palette
523
524Render `SymbolPaletteComponent` alongside `DiagramComponent`. Define palettes with shape arrays, set `symbolHeight`/`symbolWidth`, and users can drag shapes onto the canvas. For full examples see [references/symbol-palette.md](references/symbol-palette.md).
525
526---
527
528## Module Injection Reference
529
530Inject only the modules your diagram uses: `<Inject services={[HierarchicalTree, DataBinding, UndoRedo]} />`
531
532| Module | Purpose |
533|--------|---------|
534| `HierarchicalTree` | Tree and org chart layouts |
535| `MindMap` | Mind map layout |
536| `RadialTree` | Radial/circular layout |
537| `ComplexHierarchicalTree` | Multi-parent hierarchies |
538| `DataBinding` | Data source integration |
539| `UndoRedo` | Undo/redo history |
540| `Snapping` | Grid snapping |
541| `PrintAndExport` | Export & print |
542| `BpmnDiagrams` | BPMN shapes |
543| `ErDiagrams` | ER diagram shapes and relationships |
544| `LayoutAnimation` | Animated layouts |
545| `DiagramContextMenu` | Right-click context menu |
546| `ConnectorBridging` | Bridge overlapping connectors |
547| `ConnectorEditing` | Edit connector segments |
548| `Ej1Serialization` | Load EJ1 diagram JSON |
549
550---
551
552## Key Props
553
554| Prop | Type | Description |
555|------|------|-------------|
556| `nodes` | `NodeModel[]` | Array of node definitions |
557| `connectors` | `ConnectorModel[]` | Array of connector definitions |
558| `layout` | `LayoutModel` | Automatic layout configuration |
559| `dataSourceSettings` | `DataSourceModel` | Data source for auto-generated diagrams |
560| `getNodeDefaults` | `(node) => NodeModel` | Default properties for all nodes |
561| `getConnectorDefaults` | `(obj) => ConnectorModel` | Default properties for all connectors |
562| `setNodeTemplate` | `(node) => DiagramElement` | Custom template rendering for nodes |
563| `tool` | `DiagramTools` | Active interaction tool mode |
564| `snapSettings` | `SnapSettingsModel` | Grid and snap configuration |
565| `scrollSettings` | `ScrollSettingsModel` | Scroll limits and zoom bounds |
566| `pageSettings` | `PageSettingsModel` | Page size, orientation, background |
567| `constraints` | `DiagramConstraints` | Enable/disable diagram-level interactions |
568| `width` | `string` | Diagram canvas width (e.g., `'100%'`) |
569| `height` | `string` | Diagram canvas height (e.g., `'600px'`) |
570
571## Related Components
572
573- [Chart](../implementing-charts/) - Data-driven charts and graphs
574- [Kanban](../implementing-kanban/) - Kanban board visualization
575- [Data Grid](../../grids/implementing-data-grids/) - Tabular data display