@@ -722,6 +722,58 @@ const elements = ref([
722722
723723 Does not work for the ` addEdge ` utility!
724724
725+ ### auto-connect <Badge class =" text-white " style =" line-height : inherit " text =" optional " vertical =" top " />
726+
727+ - Type: ` boolean ` | [ ` Connector ` ] ( /typedocs/types/Connector.html/ )
728+
729+ - Default: ` false `
730+
731+ - Details:
732+
733+ When connection is emitted, automatically create a new edge from params.
734+
735+ Also accepts a [ ` Connector ` ] ( /typedocs/types/Connector.html/ ) which returns an edge-like object or false (if creating an edge is not allowed).
736+
737+ This option can be used as a shorthand for ` onConnect((params) => addEdges([params])) ` .
738+
739+ #### Examples
740+
741+ ##### Boolean value
742+
743+ ``` vue:no-line-numbers{2}
744+ <template>
745+ <VueFlow v-model="elements" auto-connect />
746+ </template>
747+ ```
748+
749+ #### [ Connector] ( /typedocs/types/Connector.html/ )
750+
751+ ``` vue:no-line-numbers{6-18,22}
752+ <script setup>
753+ import { ref } from 'vue'
754+
755+ const elements = ref([/** elements omitted for simplicity */])
756+
757+ const connector = (params) => {
758+ if (params.source.id === params.target.id) {
759+ return false
760+ }
761+
762+ return {
763+ id: `edge-${params.source.id}-${params.target.id}`,
764+ source: params.source.id,
765+ target: params.target.id,
766+ label: `Edge ${params.source.id}-${params.target.id}`,
767+ animated: true,
768+ }
769+ }
770+ </script>
771+
772+ <template>
773+ <VueFlow v-model="elements" :auto-connect="connector" />
774+ </template>
775+ ```
776+
725777## Global Element Options
726778
727779### only-render-visible-elements <Badge class =" text-white " style =" line-height : inherit " text =" optional " vertical =" top " />
0 commit comments