Skip to content

Commit

Permalink
Merge pull request #515 from JakeWritesCode/update-custom-handle-example
Browse files Browse the repository at this point in the history
fix(custom-handle-example): update the custom handle example to svelte syntax
  • Loading branch information
moklick authored Sep 17, 2024
2 parents 3b89d6c + 5039ccc commit ed413aa
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 ed413aa

Please sign in to comment.