Skip to content

how to add label to edges which are nor pre defined? #372

Answered by bcakmakoglu
Milad0071 asked this question in Q&A
Discussion options

You must be logged in to vote

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:

onConnect((params) => {
	addEdges([params])
})

addEdges accepts all the parameters your "predefined" Edges can have, i.e. you can just add "label" to the params you pass to addEdges

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'

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Milad0071
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants