Hi,
I’m trying to display node labels permanently, not only on hover, and to have them rendered inside the node itself, e.g. inside a rectangular shape with rounded corners (see images below for what I mean).
I’d also like to support multi-line labels for longer node names.
So far, I’ve tried implementing this using nodeCanvasObject() (Text as nodes), where I draw the background and the text manually. It looks correct visually, but then ForceGraph no longer recognizes these as real nodes. Because of that, built-in features like onNodeHover() and onLinkHover() no longer work as expected.
My question:
Is there already a built-in or recommended way to achieve this?
Or would it be possible to add such an option in the future, something like always-visible labels inside customizable node shapes (e.g., rounded rectangles) that still support the default interactions?
Examples (what I mean):
✅ Correct (expected behavior)
❌ Wrong (current label rendering)
Thanks in advance and thanks for maintaining this great library!



Hi,
I’m trying to display node labels permanently, not only on hover, and to have them rendered inside the node itself, e.g. inside a rectangular shape with rounded corners (see images below for what I mean).
I’d also like to support multi-line labels for longer node names.
So far, I’ve tried implementing this using nodeCanvasObject() (Text as nodes), where I draw the background and the text manually. It looks correct visually, but then ForceGraph no longer recognizes these as real nodes. Because of that, built-in features like onNodeHover() and onLinkHover() no longer work as expected.
My question:
Is there already a built-in or recommended way to achieve this?
Or would it be possible to add such an option in the future, something like always-visible labels inside customizable node shapes (e.g., rounded rectangles) that still support the default interactions?
Examples (what I mean):
✅ Correct (expected behavior)
❌ Wrong (current label rendering)
Thanks in advance and thanks for maintaining this great library!