diff --git a/docs/src/guide/config.md b/docs/src/guide/config.md index fc011986..b1bc92fd 100644 --- a/docs/src/guide/config.md +++ b/docs/src/guide/config.md @@ -1,2 +1,746 @@ # Config +Vue Flow allows you to configure zoom, graph and flow behavior. +Configuration can be passed either as props to the `VueFlow` component or +as options to the `useVueFlow` composable. + + + + +```vue:no-line-numbers + + +``` + + + + + + +```vue:no-line-numbers + +``` + + + + +## Updating Config + +You can update the configuration at any point, either by having them bound as props or using the state values returned by `useVueFlow`. + + + + +```vue:no-line-numbers{2,5-6,10} + + +``` + + + + + + +```vue:no-line-numbers{2,7-8} + +``` + + + + +## Basic Options + +### id + +- Type: `string` + +- Details: + + Unique id of Vue Flow. + + It is used for the lookup and injection of the state instance. + +### modelValue + +- Type: [`Elements`](https://types.vueflow.dev/modules.html#Elements) + +- Details: + + An array of elements (nodes + edges). + + Use either the modelValue prop or nodes/edges separately. __Do not mix them!__ + +- Example: + +```vue:no-line-numbers + + +``` + +### nodes + +- Type: [`Node[]`](https://types.vueflow.dev/interfaces/Node.html) + +- Details: + + An array of nodes. + + Use either the modelValue prop or nodes separately. __Do not mix them!__ + +- Example: + +```vue:no-line-numbers + + +``` + +### edges + +- Type: [`Edge[]`](https://types.vueflow.dev/interfaces/Edge.html) + +- Details: + + An array of edges. + + Use either the modelValue prop or edges separately. __Do not mix them!__ + +- Example: + +```vue:no-line-numbers + + +``` + +### node-types + +- Type: [`Record`](https://types.vueflow.dev/modules.html#NodeComponent) + +- Default: [`DefaultNodeTypes`](https://types.vueflow.dev/modules.html#DefaultNodeTypes) + +- Details: + + An object mapping node-type names to component definitions/name. + +- Example: + +```vue:no-line-numbers + + +``` + +### edge-types + +- Type: [`Record`](https://types.vueflow.dev/modules.html#EdgeComponent) + +- Default: [`DefaultEdgeTypes`](https://types.vueflow.dev/modules.html#DefaultEdgeTypes) + +- Details: + + An object mapping edge-type names to component definitions/name. + +- Example: + +```vue:no-line-numbers + + +``` + +### apply-default + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable/disable default state update handlers. + + If you want to have full control of state changes, you can disable the default behavior and apply your own change handlers to the state. + +- Example: + +```vue:no-line-numbers + + +``` + +### connection-mode + +- Type: [`ConnectionMode`](https://types.vueflow.dev/enums/ConnectionMode.html) + +- Default: `ConnectionMode.Loose` + +- Details: + + If set to `loose` all handles are treated as source handles (thus allowing for connections on target handles as well.) + +### connection-line-type + +- Type: [`ConnectionLineType`](https://types.vueflow.dev/enums/ConnectionLineType.html) + +- Default: `ConnectionLineType.Bezier` + +- Details: + + The path to use when drawing a connection-line (`bezier`, `step`, `smoothstep`). + + When using a custom connection line this prop does nothing. + +### connection-line-style + +- Type: `CSSProperties` | `null` + +- Details: + + Additional styles to add to the default connection-line. + +### fit-view-on-init + +- Type: `boolean` + +- Default: `false` + +- Details: + + Trigger fit view when transformation-pane is mounted. + +## Zoom & Pan Options + +### zoom-activation-key-code + +- Type: `KeyCode` + +- Default: `Meta` + +- Details: + + Define a key which can be used to activate zoom. + + Overwrites zoom-on-scroll or pan-on-scroll behavior as long as the key is pressed. + +### zoom-on-scroll + +- Type: `boolean` + +- Default: `true` + +- Details: + + Whether to allow zooming in and out when scrolling inside the Vue Flow container. + +### zoom-on-pinch + +- Type: `boolean` + +- Default: `true` + +- Details: + + Whether to allow zooming in and out when pinching (touch or trackpad) inside the Vue Flow container. + +### zoom-on-double-click + +- Type: `boolean` + +- Default: `true` + +- Details: + + Whether to allow zooming in and out when double-clicking (or tapping) inside the Vue Flow container. + +### pan-on-scroll + +- Type: `boolean` + +- Default: `false` + +- Details: + + Whether to allow panning inside the Vue Flow container. + + Does not work together with `zoom-on-scroll` but will work together with `zoom-activation-key-code`. + +### pan-on-scroll-speed + +- Type: `number` + +- Default: `0.5` + +### pan-on-scroll-mode + +- Type: [`PanOnScrollMode`](https://types.vueflow.dev/enums/PanOnScrollMode.html) + +- Default: `PanOnScrollMode.Free` + +- Details: + + Specify on which axis panning is allowed (x, y or both). + +### pan-on-drag + +- Old name: `paneMovable` + +- Type: `boolean` + +- Default: `true` + +- Details: + + Whether to allow moving the pane when dragging inside the Vue Flow container. + +### prevent-scrolling + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable this to prevent vue flow from scrolling inside its container, i.e. allow for the page to scroll. + +### no-wheel-class-name + +- Type: `string` + +- Default: `nowheel` + +- Details: + + Set a class name which prevents elements from triggering wheel-scroll events (thus disabling zoom/pan-scroll behavior on the element). + + Useful if you want to allow for scrolling _inside_ a node + +### no-pan-class-name + +- Type: `string` + +- Default: `nopan` + +- Details: + + Set a class name which prevents elements from triggering pan-scroll events. + +### min-zoom + +- Type: `number` + +- Default: `0.5` + +### max-zoom + +- Type: `number` + +- Default: `2` + +### default-zoom + +- Type: `number` + +- Default: `1` + +### default-position + +- Type: `[x: number, y: number]` + +- Default: `[0, 0]` + +- Details: + + Default zoom pane position on initial load. + +### translate-extent + +- Type: [`CoordinateExtent`](https://types.vueflow.dev/modules.html#CoordinateExtent) + +- Default: + +```ts:no-line-numbers +[ + [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY], + [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY], +] +``` + +- Details: + + The area in which the zoom pane can be moved around. + +## Selection Pane Options + +### selection-key-code + +- Type: `KeyCode` + +- Default: `Shift` + +- Details: + + Define a key which can be used to activate the selection rect. + +### multi-selection-key-code + +- Type: `KeyCode` + +- Default: `Meta` + +- Details: + + Define a key which can be used to activate multi-selection. + + Multi-selection can be used to select multiple nodes with clicks. + +### delete-key-code + +- Type: `KeyCode` + +- Default: `Backspace` + +- Details: + + Define a key which can be used to activate remove elements from the pane. + + + +## Global Node Options + +### nodes-draggable + +- Type: `boolean` + +- Default: `true` + +- Details: + + Globally enable/disable dragging nodes. + + Can be overwritten by setting `draggable` on a specific node element. + +- Example: + +```vue:no-line-numbers{5-6,10} + + +``` + +### nodes-connectable + +- Type: `boolean` + +- Default: `true` + +- Details: + + Globally enable/disable connecting nodes. + + Can be overwritten by setting `connectable` on a specific node element. + +- Example: + +```vue:no-line-numbers{5-6,10} + + +``` + +### nodes-extent + +- Type: [`CoordinateExtent`](https://types.vueflow.dev/modules.html#CoordinateExtent) + +- Default: + +```ts:no-line-numbers +[ + [Number.NEGATIVE_INFINITY, Number.NEGATIVE_INFINITY], + [Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY], +] +``` + +- Details: + + The area in which nodes can be moved around. + + Can be overwritten by setting `extent` on a specific node element. + +- Example: + +```vue:no-line-numbers{5-6} + + +``` + +### select-nodes-on-drag + +- Type: `boolean` + +- Default: `true` + +### snap-to-grid + +- Type: `boolean` + +- Default: `false` + +- Details: + + If enabled, nodes will be placed and moved in a grid-like fashion. + +### snap-grid + +- Type: [`SnapGrid`](https://types.vueflow.dev/modules.html#SnapGrid) + +- Default: `[15, 15]` + +- Details: + + If `snapToGrid` is enabled, nodes will be placed and moved in a grid-like fashion according to the `snapGrid` value. + +## Global Edge Options + +### edges-updatable + +- Type: `boolean` + +- Default: `true` + +- Details: + + Globally enable/disable updating edges. + + Can be overwritten by setting `updatable` on a specific edge element. + +- Example: + +```vue:no-line-numbers{7-8,12} + + +``` + +### default-marker-color + +- Type: `string` + +- Default: `#b1b1b7` + +- Details: + + The default color value which is used when presenting edge-markers (arrowheads). + +### edge-updater-radius + +- Type: `number` + +- Default: `10` + +- Details: + + The radius at which an edge-updater can be triggered. + +### connect-on-click + +- Type: `boolean` + +- Default: `true` + +- Details: + + Allow edges to be created by clicking two handles in a row. + + Useful if you want to enable creating edges on a touch device. + +### default-edge-options + +- Type: [`DefaultEdgeOptions`]() + +- Details: + + Default values when creating a new edge. + + Does not work for the `addEdge` utility! + +## Global Element Options + +### only-render-visible-elements + +- Type: `boolean` + +- Default: `false` + +- Details: + + Skip rendering elements that are not visible currently (either hidden or outside the current pane dimensions). + +### elements-selectable + +- Type: `boolean` + +- Default: `true` + +- Details: + + Enable/disable selecting elements. This will also disable pointer-events in general. diff --git a/docs/src/guide/edge.md b/docs/src/guide/edge.md new file mode 100644 index 00000000..e69de29b