Skip to content

Commit 30f158c

Browse files
committed
chore(docs): update validation example text
1 parent 7c1cf13 commit 30f158c

File tree

1 file changed

+7
-19
lines changed

1 file changed

+7
-19
lines changed

docs/src/examples/edges/validation.md

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,20 @@
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>

0 commit comments

Comments
 (0)