How to Set HTML Templates for Multiple Nodes in Javascript Diagram?
In Syncfusion® JavaScript 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
var node = [ {
offsetX: 100,
offsetY: 100,
width: 120,
height: 100,
style: { fill: '#6BA5D7', strokeColor: 'white' },
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,
style: { fill: '#FFD700', strokeColor: 'white' },
shape: {
type: 'HTML',
content: '<div style="background:#FBF6A4;height:100%;width:100%;"><input type="color" value="#ff0000" style="width:100%"></div>'
}
},]
Sample: Click here for sample
Conclusion
I hope you enjoyed learning how to set individual HTML templates for multiple nodes in Javascript Diagram
You can refer to our JavaScript 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 JavaScript 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, Direct-Trac, or feedback portal. We are always happy to assist you!