uber / react-digraph

A library for creating directed graph editors
MIT License
2.62k stars 269 forks source link

Does this work with generic non-SVG components? #262

Open Aditya94A opened 4 years ago

Aditya94A commented 4 years ago

I would like to use my own react components as graph nodes instead of SVGs. Is this supported?

ajbogh commented 4 years ago

You can pass a renderNode function that returns a react component. These components must be SVGs, but you can use the foreignObject element to wrap HTML data as well. A few people have used this method for their projects.

https://developer.mozilla.org/en-US/docs/Web/SVG/Element/foreignObject

tony-garcia commented 4 years ago

Yes I've used foreignObject to render HTML nodes using React and it works quite well.