Connection limits (quick example) Cap how many edges can attach to a port. Priority: handleConfig[port].maxConnections → node.maxConnectionsPerPort → [maxConnectionsPerHandle].
TypeScript Copy
<ngx-workflow-diagram
[nodes]="nodes()"
[edges]="edges()"
[maxConnectionsPerHandle]="2"
(nodesChange)="nodes.set($event)"
(edgesChange)="edges.set($event)"
/>
// Per-node / per-port overrides
nodes.set([{
id: 'process',
label: 'Process',
position: { x: 120, y: 80 },
ports: 4,
maxConnectionsPerPort: 1,
handleConfig: {
bottom: { maxConnections: 3 }
}
}]); These fields (and RGBA colors, edge animation, markers) are also editable in the properties sidebar when a node is selected (“Max connections / port” and “Per-port limits”).
Data Input Type Default Description [nodes]Node[][]Controlled array of nodes to display. Syncs into diagram state when provided. [edges]Edge[] | undefinedundefinedControlled edges array. Pass an array (including []) for controlled mode; omit for uncontrolled internal state. [initialNodes]Node[][]Seed nodes used once on first init when not driving [nodes] as controlled state. [initialEdges]Edge[][]Seed edges used once on first init when not driving [edges] as controlled state. [nodeTypes]Record<string, Type<any>>{}Map of custom node type name → Angular component class. [defsTemplate]TemplateRef<any>undefinedAngular template containing SVG <defs> (markers, gradients, filters). [edgeTemplate]TemplateRef<any>undefinedCustom template for rendering edge labels / overlays.
Viewport Input Type Default Description [initialViewport]ViewportundefinedInitial viewport state { x, y, zoom }. Useful for restoring saved views. [minZoom]number0.1Minimum allowed zoom level. [maxZoom]number4Maximum allowed zoom level. [autoPanOnNodeDrag]booleantruePan canvas automatically when dragging a node near the viewport edge. [autoPanOnConnect]booleantruePan canvas automatically when dragging a connection near the viewport edge. [autoPanSpeed]number15Pixels per frame for auto-pan. [autoPanEdgeThreshold]number50Distance in pixels from the viewport edge to trigger auto-pan.
Appearance Input Type Default Description [showBackground]booleantrueWhether to show the background pattern (dots/lines/cross). [backgroundVariant]'dots' | 'lines' | 'cross''dots'Background pattern style. [backgroundImage]string | nullnullURL for a custom background image. Overrides pattern if set. [backgroundGap]number20Gap between background pattern elements in pixels. [backgroundSize]number1Size of background pattern elements (e.g. dot radius). [backgroundColor]string'#81818a'Color of the background pattern dots/lines. [backgroundBgColor]string'transparent'Base canvas background color. [colorMode]'light' | 'dark' | 'system'undefined (inherit host app)Color theme for this diagram only. When unset, inherits the host page theme and never mutates document.documentElement. [zIndexMode]'default' | 'layered''default'Strategy for node z-indexing / stacking. [showGrid]booleanfalseShow a grid overlay on the canvas.
Controls Behavior Input Type Default Description [connectionValidator](source: string, target: string) => booleanundefinedGlobal custom validator for new connections (node ids only). [validateConnection](connection) => booleanundefinedRicher connection validation including source/target handle ids. [maxConnectionsPerHandle]number | undefinedundefinedGlobal max edges per port. Overridden by node.maxConnectionsPerPort and handleConfig[port].maxConnections. Leave undefined for unlimited. [proximityThreshold]number200Distance (graph units) for auto-connect when dragging a node near another. [nodesResizable]booleantrueGlobal toggle to enable/disable node resizing. [snapToGrid]booleanfalseSnap node positions to the grid while dragging. [gridSize]number20Grid size in pixels for snap-to-grid. [preventNodeOverlap]booleanfalseEnable collision detection to prevent nodes overlapping. [nodeSpacing]number10Minimum spacing between nodes when preventNodeOverlap is true. [edgeReconnectable]booleanfalseAllow dragging edge endpoints to reconnect them to other ports. [optimization]FlowOptimization{ virtualization: true, adaptiveBuffer: true, hideEdgesBelowZoom: 0.4 }Performance tuning options for large diagrams (spatial culling, adaptive zoom buffer, edge virtualization, and hideEdgesBelowZoom threshold).
Persistence Input Type Default Description [autoSave]booleanfalseEnable auto-saving of diagram state to localStorage. [autoSaveInterval]number1000Throttled auto-save interval in milliseconds. [maxVersions]number10Max number of auto-save version snapshots to keep.
Node model fields (not diagram inputs) Set these on each Node object in [nodes]:
Field Type Description ports0 | 1 | 2 | 3 | 40=None, 1=Top, 2=Top/Bottom, 3=Left/Right, 4=All (default). maxConnectionsPerPortnumberDefault max edges for every port on this node. handleConfig[id].maxConnectionsnumberOverride limit for a specific port (top, right, bottom, left). handleConfig[id].isConnectableboolean | number | fnWhether the port accepts connections (number = max count). easyConnectbooleanDrag from node body to start a connection (use .drag-handle to move).