Skip to content

Commit

Permalink
fix(custom-handle-example): update the custom handle example to svelt…
Browse files Browse the repository at this point in the history
…e syntax
  • Loading branch information
JakeWritesCode committed Sep 14, 2024
1 parent 3b89d6c commit 5039ccc
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions sites/svelteflow.dev/src/pages/api-reference/components/handle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,26 @@ connection source matches a given id.

```svelte
<script>
import { Handle, Position } from '@xyflow/svelte';
import { Handle, Position } from '@xyflow/svelte';
export let position;
export let source;
function isValidConnection(connection) {
if (connection.source === source) {
return true;
}
return false;
}
</script>
export const TargetHandleWithValidation = ({ position, source }) => (
<Handle
type="target"
position={position}
isValidConnection={(connection) => connection.source === source}
style={{ background: '#fff' }}
/>
);
<Handle
type="target"
position={position}
{isValidConnection}
style="background: #fff"
/>
```

### Style handles when connecting
Expand Down

0 comments on commit 5039ccc

Please sign in to comment.