how to add label to edges which are nor pre defined? #372
-
Hello again i hope you are all right. I need to add label to edges which user draw from one node to the other. in the examples labels are defined only for pre defined and static edges. is there any way for labeling non static edges? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
You can add a label whenever you want basically. So something like this: onConnect((params) => {
addEdges([params])
})
So something like this: onConnect((params) => {
addEdges([{ ...params, label: 'Some Edge Label' }])
}) and you're done. You can also just grab an edge from the store and add a label to it. const edge = findEdge(id)
edge.label = 'foobar' |
Beta Was this translation helpful? Give feedback.
You can add a label whenever you want basically.
But I assume you want to add a label when the
connect
event is triggered.So something like this:
addEdges
accepts all the parameters your "predefined" Edges can have, i.e. you can just add "label" to the params you pass toaddEdges
So something like this:
and you're done.
You can also just grab an edge from the store and add a label to it.