Articles in this section
Category / Section

How to change the stroke style and color of the highlighter when dragging a node into another node in Javascript Diagram?

2 mins read

Syncfusion® JavaScript Diagram provides the ability to customize the style of the highlighter. You can modify the stroke color of the highlighter when dragging and dropping a node over another element by using the .e-diagram-highlighter class.

Enabling Highlighter for a Node

To enable the highlighter for a node, you need to set the allowDrop constraints for that specific node. This can be achieved by modifying the node’s constraints as shown in the following example:

{
    id: 'node1',
    offsetX: 300, offsetY: 300,
    height: 100, width: 100,
    constraints: ej.diagrams.NodeConstraints.Default | ej.diagrams.NodeConstraints.AllowDrop
}

Customizing the Highlighter Style

The highlighter’s style can be customized using CSS. For instance, to change the stroke color of the highlighter, you need define the style for the .e-diagram-highlighter class as follows:

<style>
   .e-diagram-highlighter {
       stroke: blue;
   }
</style> 

You can find a working example of this implementation on StackBlitz in the provided link: Click here for sample

Conclusion

I hope you enjoyed learning how to change the stroke style and color of the highlighter when dragging a node into another node using 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!

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