The DiagramView React component allows integrating the MindFusion.Diagramming API into React applications. It renders a Diagram instance assigned to "diagram" prop as its model.
At this time, the following properties can be set from JSX too: allowInplaceEdit, autoResize, backBrush, behavior, defaultShape, enabled, linkHeadShapeSize, linkShape, roundedLinks, routeLinks, showAnchors, showGrid, zoomFactor. All diagram events can be handled through JSX syntax as well:
JSX Copy Code |
---|
const [diagram] = useState(new Diagramming.Diagram()); |
The DiagramView control exposes a forwardRef, that can be passed on to other controls, such as the Overview and ZoomControl. To obtain a reference to the underlying core controls, use the respective find method of the ref.
DiagramView can be installed from the @mindfusion/diagramming-react package on npm:
npm i @mindfusion/diagramming-react
Several React examples are included in JsDiagram's distribution. In order to run them, execute the following npm commands from command line in Samples/React folder:
npm install
npm start
JSX Copy Code |
---|
this.state.diagram = new Diagramming.Diagram(); |
Class components can be installed from the @mindfusion/diagramming-react-cc package on npm:
npm i @mindfusion/diagramming-react-cc