File tree Expand file tree Collapse file tree 1 file changed +7
-19
lines changed
Expand file tree Collapse file tree 1 file changed +7
-19
lines changed Original file line number Diff line number Diff line change 11# Connection Validation
22
3- Connections can be validated before edges are created and nodes get connected.
3+ To validate connections before they are created you can either pass a function to the ` is-valid-connection ` prop of the ` <Handle /> ` component
4+ or use the ` onConnect ` event of the ` <VueFlow /> ` component.
5+
6+ Another alternative is to pass a ` isValidConnection ` function to the ` is-valid-connection ` prop of the ` <VueFlow /> ` component.
7+ This function will be applied to * all* connections in the flow (even existing ones).
48
59## Using a handle in a custom node
610
711``` vue
812<div>
9- [ ... ]
10-
11- <Handle type="source" :is-valid-connection="isValidConnection" />
13+ <!-- ... -->
14+ <Handle type="source" :is-valid-connection="isValidConnection"/>
1215</div>
1316```
1417
15- ## Passing as node option
16-
17- ``` ts
18- const nodes = [
19- {
20- id: ' 1' ,
21- label: ' Node 1' ,
22- position: { x: 0 , y: 0 },
23- isValidSourcePos : (connection ) => {
24- return connection .target === ' 2'
25- },
26- },
27- ]
28- ```
29-
3018<div class =" mt-6 " >
3119 <Repl example =" validation " ></Repl >
3220</div >
You can’t perform that action at this time.
0 commit comments