Articles in this section

How to Customize Expand/Collapse Icon Size in JavaScript Diagram?

The JavaScript Diagram allows to expand/collapse the subtrees of a layout. The node’s isExpanded property 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 expand and collapse 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, diagram) {
   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/n883tq-cikger?file=index.js

Conclusion
I hope you enjoyed learning how to customize the expand/collapse icon size in JavaScript Diagram.
You can refer to our JavaScript 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 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!

Did you find this information helpful?
Yes
No
Help us improve this page
Please provide feedback or comments
Comments (0)
Access denied
Access denied