How to Change Radial Tree Node With Custom HTML in React Diagram?
This article explains how to customize the nodes in a radial tree with custom HTML using the Syncfusion® React Diagram component. You need to set the node’s shape type to HTML. This allows you to include custom HTML content within each node. Once the shape type is set, you can define the nodeTemplate property to specify how each node should render using your custom HTML.
The nodeTemplate function provides the necessary structure for the HTML content, enabling you to fully customize the appearance of each node in the radial tree.
The below code snippet demonstrates how to change the Radial tree node with custom HTML:
//Sets the default values for a node.
function getNodeDefaults(obj) {
obj.shape.type = 'HTML',
obj.width = 150,
obj.height = 150
return obj;
}
function nodeTemplate(props) {
return (
<div style={{ background: 'black', height: '100%', width: '100%', textAlign: 'center', borderRadius: '40%', color: 'white' }}>
<h1>{props.data.Name}</h1>
</div>
);
}
getNodeDefaults={getNodeDefaults}
nodeTemplate={nodeTemplate.bind(this)}
Refer to the working sample for additional details and implementation: Sample
Conclusion
We hope you enjoyed learning about how to change a Radial tree node with custom HTML 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!