Implement interactive diagrams, flowcharts, BPMN, UML, and organizational charts using Syncfusion Vue Diagram. Use this when working with diagram components, including nodes, connectors, shapes, layouts, ports, labels, symbol palettes, serialization, and export. Covers BPMN workflows, UML diagrams, swimlanes, and data visualization flows.
The Syncfusion Vue Diagram component enables you to create interactive, customizable diagrams for visualizing complex processes, organizational hierarchies, workflows, and data relationships. From simple flowcharts to advanced BPMN diagrams and UML representations, the Diagram component provides comprehensive tools for visual communication.
📄 Read: references/getting-started.md
📄 Read: references/nodes.md
📄 Read: references/connectors.md
📄 Read: references/ports.md
📄 Read: references/shapes-and-styles.md
📄 Read: references/bpmn-diagrams.md
📄 Read: references/uml-diagrams.md
📄 Read: references/layouts.md
📄 Read: references/swimlanes.md
📄 Read: references/symbol-palette.md
📄 Read: references/data-binding.md
exportDiagram (inject PrintAndExport)📄 Read: references/diagram-settings.md
<template>
<div id="app">
<ejs-diagram
id="diagram"
:width="width"
:height="height"
:nodes="nodes"
:connectors="connectors"
:snapSettings="snapSettings"
></ejs-diagram>
</div>
</template>
<script>
import { DiagramComponent,SnapConstraints } from '@syncfusion/ej2-vue-diagrams';
export default {
name: "App",
components: {
"ejs-diagram": DiagramComponent
},
data() {
return {
width: "100%",
height: "590px",
nodes: [
{
id: 'node1',
width: 100,
height: 100,
offsetX: 250,
offsetY: 250,
style: { fill: '#6BA3D5' },
annotations: [{ content: 'Node 1' }]
},
{
id: 'node2',
width: 100,
height: 100,
offsetX: 450,
offsetY: 250,
style: { fill: '#6BA3D5' },
annotations: [{ content: 'Node 2' }]
}
],
connectors: [
{
id: 'connector1',
sourceID: 'node1',
targetID: 'node2',
type: 'Orthogonal'
}
],
snapSettings: {
constraints: SnapConstraints.None
}
}
}
}
</script>
<style>
@import '../node_modules/@syncfusion/ej2-vue-diagrams/styles/material.css';
</style>
⚠️ CRITICAL: Syncfusion Diagram works with both Vue 2 and Vue 3, but patterns differ significantly.
┌─ Do you have an existing Vue project?
│
├─ YES, it's Vue 3 (Vite, create-vue, etc.)
│ └─ Use: Composition API with <script setup>
│ ✅ Modern, performant, recommended
│ 📄 Read: getting-started.md (Vue 3 Composition API section)
│
├─ YES, it's Vue 2 (Vue CLI, legacy projects)
│ └─ Use: Options API with export default
│ ✅ Compatible, but consider migrating
│ 📄 Read: getting-started.md (Vue 2 section)
│
└─ NO, starting fresh
└─ Recommended: Vue 3 with Vite
✅ Fastest, most modern
📄 Read: getting-started.md (Vite + Vue 3 setup)
Vue 3 Composition API (Recommended):
import { ref } from 'vue';
import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams';
const nodes = ref([...]); // ← Use ref()
Vue 2 Options API:
import { DiagramComponent } from '@syncfusion/ej2-vue-diagrams';
export default {
data() {
return {
nodes: [...] // ← Use data()
}
}
}
⚡ Pro Tip: If you're unsure, default to Vue 3 Composition API—it's the industry standard for new Syncfusion projects.
// Use hierarchical layout with nodes and connectors
const layout = {
type: 'HierarchicalTree',
orientation: 'TopToBottom',
horizontalSpacing: 50,
verticalSpacing: 50,
getLayoutInfo: (node, options) => {
// Customize layout per node
}
};
diagram.layout = layout;
diagram.doLayout();
// Render org chart from JSON data with DataManager
const dataSettings = {
id: 'id',
parentId: 'manager',
dataSource: new DataManager(employeeData)
};
diagram.dataSourceSettings = dataSettings;
// Handle node selection events
diagram.selectionChange = (args) => {
console.log('Selected:', args.newItems);
};
// In Vue: bind the selectionChange event and read newValue/oldValue
// <ejs-Diagram :selectionChange="onSelectionChange" ... />
const onSelectionChange = (args) => {
console.log('Selected:', args.newItems);
};
// Save state and export
const jsonData = diagram.saveDiagram();
localStorage.setItem('diagram', jsonData);
// Later: Load from storage
const saved = localStorage.getItem('diagram');
diagram.loadDiagram(saved);
// Export as PNG
diagram.export({ format: 'PNG', fileName: 'diagram' });
| Prop | Type | Purpose |
|---|---|---|
nodes | Array | Collection of diagram nodes |
connectors | Array | Collection of connectors linking nodes |
layout | Object | Automatic layout configuration |
dataSourceSettings | Object | Data binding and source configuration |
snapSettings | Object | Snap constraints and guidelines |
pageSettings | Object | Page size, orientation, margins |
scrollSettings | Object | Pan and scroll behavior |
constraints | Object | Diagram-level interaction constraints |
contextMenuSettings | Object | Right-click menu configuration |
undoRedoSettings | Object | Undo/redo behavior |