uber / react-digraph

A library for creating directed graph editors

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Does this work with generic non-SVG components?

Aditya94A opened this issue · comments

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

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

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