How to Render Only Icons in the Context Menu in React Diagram?
To render only icons in the context menu, you can enhance the visual cues by associating icons with the iconCss property of the diagram. If you want to adjust the width of the the context menu to fit the icons properly, you can override the default styles using the .e-contextmenu-wrapper ul and .e-contextmenu-container ul CSS class names. This will help you to control the menu’s layout and ensure that only icons are displayed without text.
The below code snippet demonstrating how to render only icons in the context menu:
let contextMenu = {
show: true, items: [
{
id: 'Copy', target: '.e-diagramcontent', iconCss: 'e-icons e-copy'
},
{
id: 'Cut', target: '.e-diagramcontent', iconCss: 'e-icons e-cut'
},
{
id: 'Paste', target: '.e-diagramcontent', iconCss: 'e-icons e-paste'
},
],
showCustomMenuOnly: true,
};
.e-contextmenu-wrapper ul,
.e-contextmenu-container ul {
min-width: 60px;
}
Conclusion
I hope you enjoyed learning about how to render only icons in the context menu 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, Direct-Trac, or feedback portal. We are always happy to assist you!