How to Customize the Size of Expand/Collapse Icon in React Diagram?
The React Diagram allows you to expand/collapse the subtrees of a layout. The node’s isExpanded property enables you to expand/collapse its children. The following code example demonstrates how to expand/collapse the children of a node.
The icon for expanding and collapsing can be customized by setting the shape property to one of the following options: “None,” “Plus,” “Minus,” “ArrowUp,” “ArrowDown,” “Path,” or “Template.” To increase the size of the icon, you can adjust the height and width properties of the expand/collapse icon.
function getNodeDefaults={(obj) => {
obj.expandIcon = {
height: 20,
width: 20,
shape: 'Minus',
fill: 'lightgray',
offset: {
x: 0.5,
y: 0.85,
},
borderWidth: 3,
};
obj.collapseIcon.offset = {
x: 0.5,
y: 0.85,
};
obj.collapseIcon.height = 20;
obj.collapseIcon.width = 20;
obj.collapseIcon.shape = 'Plus';
obj.borderColor = 'white';
obj.backgroundColor = '#6BA5D7';
obj.style = {
fill: 'transparent',
strokeWidth: 2,
};
return obj;
}}
Sample: https://stackblitz.com/edit/react-5qhdof-xusptf?file=index.js
Conclusion
I hope you enjoyed learning about how to customize the size of the expand/collapse icon in React Diagram.
You can refer to our React Diagram feature tour page to learn about its other groundbreaking feature representations and documentation, and how to quickly get started with 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 explore 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!