BPMN Gateway in React Diagram Component
Overview
BPMN (Business Process Model and Notation) gateways are crucial elements that control the flow of processes in business workflow diagrams. Gateways determine how process flows diverge or converge based on specific conditions, making them essential for modeling complex business logic and decision points.
Gateway
A gateway is represented as a diamond shape and serves as a decision point that controls the sequence flow within a process. Gateways can split a single incoming flow into multiple outgoing flows or merge multiple incoming flows into a single outgoing flow.
To create a gateway in the React Diagram component, set the shape property of the node to “gateway” and configure the gateway property with the appropriate gateway type. The following code example demonstrates how to create a basic BPMN gateway.
import * as React from "react";
import * as ReactDOM from "react-dom";
import { DiagramComponent, Inject, BpmnDiagrams } from "@syncfusion/ej2-react-diagrams";
// A node is created and stored in nodes array.
let node = [
{
// Position of the node
offsetX: 150,
offsetY: 150,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as Gateway
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as None
gateway: {
type: 'None',
},
},
},
{
// Position of the node
offsetX: 350,
offsetY: 150,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Inclusive
gateway: {
type: 'Inclusive',
},
},
},
{
// Position of the node
offsetX: 550,
offsetY: 150,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Exclusive
gateway: {
type: 'Exclusive',
},
},
},
{
// Position of the node
offsetX: 150,
offsetY: 350,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Parallel
gateway: {
type: 'Parallel',
},
},
},
{
// Position of the node
offsetX: 350,
offsetY: 350,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as ParallelEventBased
gateway: {
type: 'ParallelEventBased',
},
},
},
{
// Position of the node
offsetX: 550,
offsetY: 350,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as EventBased
gateway: {
type: 'EventBased',
},
},
},
{
// Position of the node
offsetX: 150,
offsetY: 550,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as ExclusiveEventBased
gateway: {
type: 'ExclusiveEventBased',
},
},
},
{
// Position of the node
offsetX: 350,
offsetY: 550,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Complex
gateway: {
type: 'Complex',
},
},
},
];
// initialize Diagram component
function App() {
return (<DiagramComponent id="container" width={'100%'} height={'600px'}
// Add node
nodes={node}>
<Inject services={[BpmnDiagrams]}/>
</DiagramComponent>);
}
const root = ReactDOM.createRoot(document.getElementById('diagram'));
root.render(<App />);import * as React from "react";
import * as ReactDOM from "react-dom";
import {DiagramComponent,NodeModel,Inject,BpmnDiagrams,} from "@syncfusion/ej2-react-diagrams";
// A node is created and stored in nodes array.
let node:NodeModel[]=[
{
// Position of the node
offsetX: 150,
offsetY: 150,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as Gateway
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as None
gateway: {
type: 'None',
},
},
},
{
// Position of the node
offsetX: 350,
offsetY: 150,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Inclusive
gateway: {
type: 'Inclusive',
},
},
},
{
// Position of the node
offsetX: 550,
offsetY: 150,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Exclusive
gateway: {
type: 'Exclusive',
},
},
},
{
// Position of the node
offsetX: 150,
offsetY: 350,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Parallel
gateway: {
type: 'Parallel',
},
},
},
{
// Position of the node
offsetX: 350,
offsetY: 350,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as ParallelEventBased
gateway: {
type: 'ParallelEventBased',
},
},
},
{
// Position of the node
offsetX: 550,
offsetY: 350,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as EventBased
gateway: {
type: 'EventBased',
},
},
},
{
// Position of the node
offsetX: 150,
offsetY: 550,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as ExclusiveEventBased
gateway: {
type: 'ExclusiveEventBased',
},
},
},
{
// Position of the node
offsetX: 350,
offsetY: 550,
// Size of the node
width: 100,
height: 100,
//Sets type as Bpmn and shape as event
shape: {
type: 'Bpmn',
shape: 'Gateway',
//Sets type of the gateway as Complex
gateway: {
type: 'Complex',
},
},
},
];
// initialize Diagram component
function App() {
return (
<DiagramComponent
id="container"
width={'100%'}
height={'600px'}
// Add node
nodes={node}
>
<Inject services={[BpmnDiagrams]} />
</DiagramComponent>
);
}
const root = ReactDOM.createRoot(document.getElementById('diagram'));
root.render(<App />);NOTE
By default, the
gatewaywill be set as none.
Gateway Types
The React Diagram component supports various gateway types, each serving specific process control requirements:
| Shape | Image |
|---|---|
| Exclusive | ![]() |
| Parallel | ![]() |
| Inclusive | ![]() |
| Complex | ![]() |
| EventBased | ![]() |
| ExclusiveEventBased | ![]() |
| ParallelEventBased | ![]() |






