@adipanda/xyflow-svelte

中文文档
1.5.7-krea.0发布于 2026/01/16MITTypeScriptES Module近 30 天下载 3567

Svelte Flow - A highly customizable Svelte library for building node-based editors, workflow systems, diagrams and more.

原始使用文档
文档目录6 节
  1. Key Features
  2. Installation
  3. Getting started
  4. How to Contribute
  5. Development
  6. Maintainers

readme-header readme-header-dark

GitHub License MIT npm downloads

Svelte Flow is a highly customizable component for building interactive graphs and node-based editors, built by the creators of React Flow.

☣️ Svelte Flow is still alpha and currently under heavy development. The API is relatively stable but some things might change. ☣️

🚀 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
  • Hooks and Utils: Hooks 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 Svelte Flow is to install it via npm, yarn or pnpm:

npm install @xyflow/svelte

Getting 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 lang="ts">
  import { writable } from 'svelte/store';
  import { SvelteFlow, Controls, Background, BackgroundVariant, MiniMap } from '@xyflow/svelte';

  // you need to import the styles for Svelte Flow to work
  // if you just want to load the basic styleds, you can import '@xyflow/svelte/dist/base.css'
  import '@xyflow/svelte/dist/style.css';

  // We are using writables for the nodes and edges to sync them easily. When a user drags a node for example, Svelte Flow updates its position. This also makes it easier to update nodes in user land.
  const nodes = writable([
    {
      id: '1',
      type: 'input',
      data: { label: 'Input Node' },
      position: { x: 0, y: 0 }
    },
    {
      id: '2',
      type: 'custom',
      data: { label: 'Node' },
      position: { x: 0, y: 150 }
    }
  ]);

  // same for edges
  const edges = writable([
    {
      id: '1-2',
      type: 'default',
      source: '1',
      target: '2',
      label: 'Edge Text'
    }
  ]);
</script>

<SvelteFlow {nodes} {edges} fitView on:nodeclick={(event) => console.log('on node click', event)}>
  <Controls />
  <Background variant={BackgroundVariant.Dots} />
  <MiniMap />
</SvelteFlow>

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 Svelte 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:

  1. pnpm install - install dependencies
  2. pnpm build - needs to be done once
  3. pnpm dev - starts dev server

You can now access the examples under http://127.0.0.1:5173

Maintainers

Svelte 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.

License

Svelte Flow is MIT licensed.

版本与发布记录

@adipanda/xyflow-svelte 共发布 8 个版本,首次发布于 2026/01/06;过去 12 个月发布了 8 个版本。

版本发布日期距今
1.5.7-krea.0latest2026/01/169 个月前
1.5.6-krea.02026/01/169 个月前
1.5.5-krea.02026/01/119 个月前
1.5.4-krea.02026/01/119 个月前
1.5.3-krea.02026/01/119 个月前
1.5.2-krea.02026/01/119 个月前

关于 @adipanda/xyflow-svelte 的常见问题

@adipanda/xyflow-svelte 是什么?

Svelte Flow - A highly customizable Svelte library for building node-based editors, workflow systems, diagrams and more.

如何安装 @adipanda/xyflow-svelte?

在项目目录运行 npm install @adipanda/xyflow-svelte,或使用 pnpm add / yarn add / bun add。它还需要宿主项目提供 peer 依赖:svelte(^5.25.0)。npm 7 及以上与 pnpm 8 及以上默认会自动安装必需的 peer 依赖,Yarn 需要手动安装。

@adipanda/xyflow-svelte 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@adipanda/xyflow-svelte 支持 ESM 还是 CommonJS?

以 ES Module 形式发布,推荐使用 import 引入。在 CommonJS 项目中,Node.js 20.19+ / 22.12+ 可以直接 require() 不含顶层 await 的 ES Module,更早的版本需要改用动态 import()。

@adipanda/xyflow-svelte 可以商用吗?

@adipanda/xyflow-svelte 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@adipanda/xyflow-svelte 的下载量有多少?

根据 npm 官方下载统计,@adipanda/xyflow-svelte 在 2026/10/05 – 2026/11/03 这 30 天内被下载 3,567 次,日均约 119 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@adipanda/xyflow-svelte 还在维护吗?

最新版本 1.5.7-krea.0 发布于 2026/01/16(9 个月前);至今共发布 8 个版本,其中过去 12 个月发布了 8 个;首次发布于 2026/01/06。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。