How to Set HTML Templates for Multiple Nodes in React Diagram?
This article explains how to set an HTML template for multiple nodes in the React Diagram. In Syncfusion® React Diagram, you can set individual HTML templates for multiple nodes by utilizing HTML-type nodes with content templates. A content template is used to define custom HTML content within nodes. To employ a custom HTML template, configure the node’s shape property to HTML and assign the desired template to the content property. This property specifies the HTML content to be rendered inside the node.
The below code snippet explains how to set individual HTML template for nodes
let nodes = [
{
offsetX: 100,
offsetY: 100,
width: 120,
height: 100,
shape: {
type: 'HTML',
content: '<div style="background:#6BA5D7;height:100%;width:100%;"><button type="button" style="width:100%">Button</button></div>'
}
},
{
offsetX: 300,
offsetY: 100,
width: 120,
height: 100,
shape: {
type: 'HTML',
content: '<div style="background:#FBF6A4;height:100%;width:100%;"><input type="color" value="#ff0000" style="width:100%"></div>'
}
},
]
Refer to the working sample for additional details and implementation: Click here for sample
Conclusion
We hope you enjoyed learning about how to set individual HTML templates for multiple nodes in React Diagram.
You can refer to our React Diagram feature tour page to know about its other groundbreaking feature representations and documentation, and how to quickly get started for configuration specifications. You can also explore our React Diagram example to understand how to create and manipulate data.
For current customers, you can check out our components from the License and Downloads page.
If you are new to Syncfusion®, you can try our 30-day free trial to check out our other controls.
If you have any queries or require clarifications, please let us know in the comments section below. You can also contact us through our support forums, BoldDesk Support, or feedback portal. We are always happy to assist you!