@xyflow/vue
v2.0.3
Published
Vue Flow - A highly customizable Vue library for building node-based editors, workflow systems, diagrams and more.
Readme
Vue Flow is a highly customizable component for building interactive graphs and node-based editors, built by the creators of React Flow and Svelte Flow.
🚀 Getting Started | 📖 Documentation | 📺 Examples | ☎️ Discord
Key Features
- Easy to use: Seamless zooming and panning, single- and multi selection of graph elements and keyboard shortcuts are supported out of the box
- Customizable: Different node and edge types and support for custom nodes with multiple handles and custom edges
- Fast rendering: Only nodes that have changed are re-rendered
- Composables and Utils: Composables for handling nodes, edges and the viewport and graph helper functions
- Plugin Components: Background, MiniMap and Controls
- Reliable: Written in Typescript and tested with Playwright
Installation
The easiest way to get the latest version of Vue Flow is to install it via npm, yarn or pnpm:
npm install @xyflow/vueGetting started
You only need a few lines to get a fully interactive (e.g. select and drag nodes or pan and zoom) flow. If you want to learn more, please refer to the learn section, the examples or the API reference.
<script setup lang="ts">
import { ref } from 'vue';
import { VueFlow, Background, Controls, MiniMap, addEdge, type Connection, type Edge, type Node } from '@xyflow/vue';
// you need to import the styles for Vue Flow to work
// if you just want to load the basic styles, you can import '@xyflow/vue/base.css'
import '@xyflow/vue/style.css';
const nodes = ref<Node[]>([
{ id: '1', type: 'input', data: { label: 'Input Node' }, position: { x: 0, y: 0 } },
{ id: '2', data: { label: 'Node' }, position: { x: 0, y: 150 } },
]);
const edges = ref<Edge[]>([{ id: '1-2', source: '1', target: '2', label: 'Edge Text' }]);
function onConnect(connection: Connection) {
edges.value = addEdge(connection, edges.value);
}
</script>
<template>
<div style="width: 100vw; height: 100vh">
<!-- v-model keeps nodes and edges in sync, e.g. when a user drags a node -->
<VueFlow v-model:nodes="nodes" v-model:edges="edges" fit-view @connect="onConnect">
<Background />
<Controls />
<MiniMap />
</VueFlow>
</div>
</template>How to Contribute
Show us what you make: Drop it in into our Discord Server, tweet at us, or email us at [email protected]
Community Participation: Ask and answer questions in our Discord Server or jump in on Github discussions.
Squash Bugs: We can’t catch them all. Check existing issues and discussions first, then create a new issue to tell us what’s up.
Financial Support: If you are an organization who wants to make sure Vue Flow continues to be maintained, reach out to us at [email protected]
And of course, we love Github stars ⭐
Development
If you want to check out the current version you need to run the following command from the root directory:
pnpm install- install dependenciespnpm build- needs to be done oncepnpm dev:vue- starts dev server
Maintainers
Vue Flow is maintained by the team behind xyflow. If you need help or want to talk to us about a collaboration, reach out through our contact form or by joining our Discord Server.
Vue Flow was originally created by Burak Cakmakoglu.
License
Vue Flow is MIT licensed.
