{
  "$schema": "https://ai.syncfusion.com/schema/registry-item.json",
  "name": "diagram-swimlane",
  "framework": "react",
  "type": "registry:component",
  "component": "Diagram",
  "variant": "swimlane",
  "dependencies": [
    "@syncfusion/ej2-react-diagrams",
    "@syncfusion/ej2-navigations"
  ],
  "description": "Swimlane diagram builds a sales process flow chart with parallel lanes, a phase header, and a symbol palette of flow shapes.",
  "meta": {
    "essentialStudioRelease": "2026 Volume 3 (v35.1.37)",
    "license": "commercial-or-community",
    "licenseNote": "The Syncfusion package is licensed. The composition in this file is source you own and edit. See https://ai.syncfusion.com/licensing.md",
    "requiresLicenseKey": true,
    "requiresServerEndpoint": false,
    "platformIndex": "https://ai.syncfusion.com/react/llms.txt",
    "skillPack": "syncfusion/react-ui-components-skills",
    "docs": "https://ai.syncfusion.com/gallery/react/js/diagram-swimlane.md"
  },
  "files": [
    {
      "target": "src/components/diagram-swimlane/Diagram.jsx",
      "content": "import * as React from \"react\";\nimport {\n  DiagramComponent,\n  SymbolPaletteComponent,\n  PortConstraints,\n  SnapConstraints,\n  SelectorConstraints,\n  PortVisibility,\n  Inject,\n  UndoRedo,\n  DiagramContextMenu,\n  randomId,\n  cloneObject,\n} from \"@syncfusion/ej2-react-diagrams\";\n\nlet diagram;\nlet pathData = 'M 120 24.9999 C 120 38.8072 109.642 50 96.8653 50 L 23.135' +\n  ' 50 C 10.3578 50 0 38.8072 0 24.9999 L 0 24.9999 C' +\n  '0 11.1928 10.3578 0 23.135 0 L 96.8653 0 C 109.642 0 120 11.1928 120 24.9999 Z';\n//Create and add ports for node.\nlet port = [\n  { id: 'Port1', offset: { x: 0, y: 0.5 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw },\n  { id: 'Port2', offset: { x: 0.5, y: 0 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw },\n  { id: 'Port3', offset: { x: 1, y: 0.5 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw },\n  { id: 'Port4', offset: { x: 0.5, y: 1 }, visibility: PortVisibility.Connect | PortVisibility.Hover, constraints: PortConstraints.Default | PortConstraints.Draw }\n];\nconst SAMPLE_CSS = `.diagram-Swimlane .sb-mobile-palette {\n  width: 195px;\n            height: 559px;\n            float: left;\n}\n .diagram-Swimlane #palette-space {\n  border: 1px solid rgba(0, 0, 0, 0.12);\n}`;\nlet nodes = [\n  {\n    id: 'swimlane',\n    shape: {\n      type: 'SwimLane',\n      orientation: 'Horizontal',\n      header: {\n        annotation: { content: 'SALES PROCESS FLOW CHART', style: { fill: 'transparent' } },\n        height: 50, style: { fontSize: 11 },\n      },\n      lanes: [\n        {\n          id: 'stackCanvas1',\n          header: {\n            annotation: { content: 'Consumer' }, width: 50,\n            style: { fontSize: 11 }\n          },\n          height: 100,\n          children: [\n            {\n              id: 'node1',\n              annotations: [\n                {\n                  content: 'Consumer learns \\n of product',\n                  style: { fontSize: 11 }\n                }\n              ],\n              margin: { left: 60, top: 30 },\n              height: 40, width: 100, ports: port\n            },\n            {\n              id: 'node2',\n              shape: { type: 'Flow', shape: 'Decision' },\n              annotations: [\n                {\n                  content: 'Does \\n Consumer want \\nthe product',\n                  style: { fontSize: 11 }\n                }\n              ],\n              margin: { left: 200, top: 20 },\n              height: 60, width: 120, ports: port\n            },\n            {\n              id: 'node3',\n              annotations: [\n                {\n                  content: 'No sales lead',\n                  style: { fontSize: 11 }\n                }\n              ],\n              margin: { left: 370, top: 30 }, shape: { type: 'Path', data: pathData },\n              height: 40, width: 100, ports: port\n            },\n            {\n              id: 'node4',\n              annotations: [\n                {\n                  content: 'Sell to consumer',\n                  style: { fontSize: 11 }\n                }\n              ],\n              margin: { left: 510, top: 30 },\n              height: 40, width: 100, ports: port\n            }\n          ],\n        },\n        {\n          id: 'stackCanvas2',\n          header: {\n            annotation: { content: 'Marketing' }, width: 50,\n            style: { fontSize: 11 }\n          },\n          height: 100,\n          children: [\n            {\n              id: 'node5',\n              annotations: [{ content: 'Create marketing campaigns' }],\n              margin: { left: 60, top: 20 },\n              height: 40, width: 100, ports: port\n            },\n            {\n              id: 'node6',\n              annotations: [{ content: 'Marketing finds sales leads' }],\n              margin: { left: 210, top: 20 },\n              height: 40, width: 100, ports: port\n            }\n          ],\n        },\n        {\n          id: 'stackCanvas3',\n          header: {\n            annotation: { content: 'Sales' }, width: 50,\n            style: { fontSize: 11 }\n          },\n          height: 100,\n          children: [\n            {\n              id: 'node7',\n              annotations: [{ content: 'Sales receives lead' }],\n              margin: { left: 210, top: 30 },\n              height: 40, width: 100, ports: port\n            }\n          ],\n        },\n        {\n          id: 'stackCanvas4',\n          header: {\n            annotation: { content: 'Success' }, width: 50,\n            style: { fontSize: 11 }\n          },\n          height: 100,\n          children: [\n            {\n              id: 'node8',\n              annotations: [{ content: 'Success helps \\n retain consumer \\n as a customer' }],\n              margin: { left: 510, top: 20 },\n              height: 50, width: 100, ports: port\n            }\n          ],\n        },\n      ],\n      phases: [\n        {\n          id: 'phase1', offset: 170,\n          header: { annotation: { content: 'Phase' } }\n        }\n      ],\n      phaseSize: 20,\n    },\n    offsetX: 360, offsetY: 320,\n    height: 100,\n    width: 650\n  },\n];\n\n//Initializes the connectors for the diagram.\nlet connectors = [\n  {\n    id: 'connector1', sourceID: 'node1',\n    targetID: 'node2'\n  },\n  {\n    id: 'connector2', sourceID: 'node2',\n    targetID: 'node3', annotations: [{ content: 'No', style: { fill: 'white' } }]\n  },\n  {\n    id: 'connector3', sourceID: 'node4',\n    targetID: 'node8'\n  },\n  {\n    id: 'connector4', sourceID: 'node2',\n    targetID: 'node6', annotations: [{ content: 'Yes', style: { fill: 'white' } }]\n  },\n  {\n    id: 'connector5', sourceID: 'node5',\n    targetID: 'node1'\n  },\n  {\n    id: 'connector6', sourceID: 'node6',\n    targetID: 'node7'\n  },\n  {\n    id: 'connector7', sourcePortID: 'Port1', targetPortID: 'Port3', sourceID: 'node4',\n    targetID: 'node7',\n  },\n];\n//Initialize the palettes for the symbol palatte\nlet palettes = [\n  {\n    id: 'flow', expanded: true, title: 'Flow Shapes', symbols: [\n      {\n        id: 'Terminator', addInfo: { tooltip: 'Terminator' }, width: 50, height: 60, shape: { type: 'Flow', shape: 'Terminator' },  ports: port\n      },\n      {\n        id: 'Process', addInfo: { tooltip: 'Process' }, width: 50, height: 60, shape: { type: 'Flow', shape: 'Process' },ports: port\n      },\n      {\n        id: 'Decision', addInfo: { tooltip: 'Decision' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'Decision' }, ports: port\n      },\n      {\n        id: 'Document', addInfo: { tooltip: 'Document' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'Document' },  ports: port\n      },\n      {\n        id: 'PreDefinedProcess', addInfo: { tooltip: 'Predefined process' }, width: 50, height: 50, shape: { type: 'Flow', shape: 'PreDefinedProcess' }, ports: port\n      },\n      {\n        id: 'data', width: 50, height: 50, addInfo: { tooltip: 'Data' }, shape: { type: 'Flow', shape: 'Data' }, ports: port\n\n      },\n    ]\n  },\n  {\n    id: 'swimlaneShapes', expanded: true,\n    title: 'Swimlane Shapes',\n    symbols: [\n      {\n        id: 'Horizontalswimlane', addInfo: { tooltip: 'Horizontal swimlane' },\n        shape: {\n          type: 'SwimLane', lanes: [\n            {\n              id: 'lane1',\n               height: 60, width: 150,\n              header: { width: 50, height: 50, style: { fontSize: 11 } },\n            }\n          ],\n          orientation: 'Horizontal', isLane: true\n        },\n        height: 60,\n        width: 140,\n        offsetX: 70,\n        offsetY: 30,\n      }, {\n        id: 'Verticalswimlane', addInfo: { tooltip: 'Vertical swimlane' },\n        shape: {\n          type: 'SwimLane',\n          lanes: [\n            {\n              id: 'lane1',\n              height: 150, width: 60,\n              header: { width: 50, height: 50, style: { fontSize: 11 } },\n            }\n          ],\n          orientation: 'Vertical', isLane: true\n        },\n        height: 140,\n        width: 60,\n        offsetX: 70,\n        offsetY: 30,\n      }, {\n        id: 'verticalPhase', addInfo: { tooltip: 'Vertical phase' },\n        shape: {\n          type: 'SwimLane',\n          phases: [{ style: { strokeWidth: 1} }],\n          annotations: [{ text: '' }],\n          orientation: 'Vertical', isPhase: true,\n        },\n        height: 60,\n        width: 140,\n      }, {\n        id: 'horizontalPhase', addInfo: { tooltip: 'Horizontal phase' },\n        shape: {\n          type: 'SwimLane',\n          phases: [{ style: { strokeWidth: 1} }],\n          annotations: [{ text: '' }],\n          orientation: 'Horizontal', isPhase: true\n        },\n        height: 60,\n        width: 140,\n      }\n    ]\n  },\n  {\n    id: 'connectors', expanded: true, symbols: [\n      {\n        id: 'orthogonal', type: 'Orthogonal', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 40, y: 40 },\n\n      },\n      {\n        id: 'Orthogonaldashed', type: 'Orthogonal', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 40, y: 40 },\n      style: {strokeDashArray: '4 4'}\n      },\n      {\n        id: 'straight', type: 'Straight', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 60, y: 60 },\n\n      },\n      {\n        id: 'straightdashed', type: 'Straight', sourcePoint: { x: 0, y: 0 }, targetPoint: { x: 60, y: 60 },\n         style: { strokeDashArray: '4 4'}\n      }\n    ], title: 'Connectors'\n  }\n];\n//Define custom menu items\nlet contextMenu = {\n  show: true, items: [\n    {\n      text: 'Copy', id: 'Copy', target: '.e-diagramcontent', iconCss: 'e-icons e-copy'\n    },\n    {\n      text: 'Cut', id: 'Cut', target: '.e-diagramcontent', iconCss: 'e-icons e-cut'\n    },\n    {\n      text: 'Paste', id: 'Paste', target: '.e-diagramcontent', iconCss: 'e-icons e-paste'\n    },\n    {\n      text: 'InsertLaneBefore', id: 'InsertLaneBefore', target: '.e-diagramcontent',\n    },\n    {\n      text: 'InsertLaneAfter', id: 'InsertLaneAfter', target: '.e-diagramcontent',\n    }],\n  showCustomMenuOnly: true,\n};\nlet diagramInstance;\n\n\nfunction SwimLane() {\n  const paletteIconRef = React.useRef(null);\n  const paletteSpaceRef = React.useRef(null);\n  React.useEffect(() => {\n    addEvents();\n    diagramInstance.fitToPage();\n  }, [])\n  let isMobile;\n //Enhances webpage functionality for mobile devices with a click event listener.\n  function addEvents() {\n    isMobile = window.matchMedia('(max-width:550px)').matches;\n    if (isMobile) {\n      let paletteIcon = paletteIconRef.current;\n      if (paletteIcon) {\n        paletteIcon.addEventListener('click', openPalette, false);\n      }\n    }\n  }\n// Manages the visibility state of the palette space on the webpage for mobile devices.\n  function openPalette() {\n    let paletteSpace = paletteSpaceRef.current;\n    isMobile = window.matchMedia('(max-width:550px)').matches;\n    if (isMobile && paletteSpace) {\n      if (!paletteSpace.classList.contains('sb-mobile-palette-open')) {\n        paletteSpace.classList.add('sb-mobile-palette-open');\n      } else {\n        paletteSpace.classList.remove('sb-mobile-palette-open');\n      }\n    }\n  }\n  //Sets the default values of a Connector.\n  function getConnectorDefaults(connector) {\n    if ((connector.id.indexOf(\"straight\") !== -1) || (connector.id.indexOf(\"straightdashed\") !== -1)) {\n      connector.type = 'Straight';\n    }\n    else {\n      connector.type = 'Orthogonal';\n    }\n    setConnectorStyles(connector, '#717171');\n    return connector;\n  }\n  //set styles for connector\n  function setConnectorStyles(connector, color) {\n    connector.style.strokeWidth = 1;\n    connector.style.strokeColor = color;\n    connector.targetDecorator.style.fill = color;\n    connector.targetDecorator.style.strokeColor = color;\n}\n  //Sets the default values for a node.\n  function getNodeDefaults(node) {\n    node.style.strokeColor = \"#717171\";\n    return node;\n  }\n   //Opens the context menu items\n  function contextMenuOpen(args) {\n    diagram = diagramInstance;\n    for (let item of args.items) {\n      if ((diagram.selectedItems.connectors.length + diagram.selectedItems.nodes.length) > 0) {\n        if (item.id === 'InsertLaneBefore' || item.id === 'InsertLaneAfter') {\n          if (diagram.selectedItems.connectors.length || (diagram.selectedItems.nodes.length && !diagram.selectedItems.nodes[0].isLane)) {\n            args.hiddenItems.push(item.text);\n          }\n        }\n      } else {\n        args.hiddenItems.push(item.text);\n      }\n    }\n  }\n//Handles click events on menu items.\n  function contextMenuClick(args) {\n    diagram = diagramInstance;\n    if (args.item.id === 'InsertLaneBefore' || args.item.id === 'InsertLaneAfter') {\n      if (diagram.selectedItems.nodes.length > 0 && diagram.selectedItems.nodes[0].isLane) {\n        let index;\n        let node = diagram.selectedItems.nodes[0];\n        let swimlane = diagram.getObject(diagram.selectedItems.nodes[0].parentId);\n        let shape = swimlane.shape;\n        let existingLane = cloneObject(shape.lanes[0]);\n\n        let newLane = {\n          id: randomId(),\n          header: {\n            width: existingLane.header.width, height: existingLane.header.height,\n            style: existingLane.header.style\n          },\n          style: existingLane.style,\n          height: existingLane.height, width: existingLane.width,\n        };\n\n        if (shape.orientation === 'Horizontal') {\n          let exclude = 0;\n          exclude += (shape.header) ? 1 : 0;\n          exclude += (shape.phases.length) ? 1 : 0;\n          index = node.rowIndex - exclude;\n          newLane.header.width = existingLane.header.width;\n          newLane.header.height = existingLane.height;\n        } else {\n          index = node.columnIndex - (shape.phases.length) ? 1 : 0;\n          newLane.header.width = existingLane.width;\n          newLane.header.height = existingLane.header.height;\n        }\n        if (args.item.id === 'InsertLaneBefore') {\n          diagram.addLanes(swimlane, [newLane], index);\n        } else {\n          diagram.addLanes(swimlane, [newLane], index + 1);\n        }\n        diagram.clearSelection();\n      }\n    } else if (args.item.id === 'Cut') {\n      diagram.cut();\n    } else if (args.item.id === 'Copy') {\n      diagram.copy();\n    } else if (args.item.id === 'Paste') {\n      diagram.paste();\n    }\n  }\n  return (\n    <div className=\"control-pane diagram-Swimlane\">\n      <style>{SAMPLE_CSS}</style>\n      <div className=\"control-section\">\n        <div style={{ width: \"100%\" }}>\n          <div className=\"sb-mobile-palette-bar\">\n            <div id=\"palette-icon\" ref={paletteIconRef} style={{ float: \"right\" }} className=\"e-ddb-icons1 e-toggle-palette\"></div>\n          </div>\n          <div\n            id=\"palette-space\" ref={paletteSpaceRef} className=\"sb-mobile-palette\"\n          >\n            <SymbolPaletteComponent\n              id=\"symbolpalette\"\n              expandMode=\"Multiple\"\n              palettes={palettes}\n              getNodeDefaults={getNodeDefaults}\n              getConnectorDefaults={getConnectorDefaults}\n              width={\"100%\"}\n              height={\"560px\"}\n              symbolHeight={48}\n              symbolWidth={48}\n              symbolMargin={{ left: 8, right: 8, top: 8, bottom: 8 }}\n              getSymbolInfo={(symbol) => {\n                return { tooltip: symbol.addInfo ? symbol.addInfo.tooltip : symbol.id };\n              }}\n            />\n          </div>\n          <div\n            id=\"diagram-space\" className=\"sb-mobile-diagram\"\n          >\n            <DiagramComponent\n              id=\"diagram\"\n              ref={(diagram) => { diagramInstance = diagram; }}\n              width={\"100%\"}\n              height={\"560px\"}\n              snapSettings={{ constraints: SnapConstraints.None }}\n              nodes={nodes}\n              connectors={connectors}\n              getNodeDefaults={getNodeDefaults}\n              getConnectorDefaults={getConnectorDefaults}\n              contextMenuSettings={contextMenu}\n              contextMenuOpen={contextMenuOpen}\n              contextMenuClick={contextMenuClick}\n              //Sets the node properties for DragEnter element.\n              dragEnter={(args) => {\n                let obj = args.element;\n                let shape = obj.shape;\n                if (shape.isLane) {\n                  if (shape.orientation === \"Horizontal\") {\n                    shape.lanes[0].height = 100;\n                    shape.lanes[0].width = 500;\n                  } else if (shape.orientation === \"Vertical\") {\n                    shape.lanes[0].height = 500;\n                    shape.lanes[0].width = 100;\n                  }\n                }\n              }}\n              selectedItems={{ constraints: SelectorConstraints.All & ~SelectorConstraints.Rotate }}\n            >\n              <Inject services={[UndoRedo, DiagramContextMenu]} />\n            </DiagramComponent>\n          </div>\n        </div>\n      </div>\n    </div>\n  );\n}\nexport default SwimLane;\n"
    }
  ]
}