Skip to Content
📣 We just released Svelte Flow 1.0 Alpha — try it out and give us your feedback!
ExamplesMiscDownload Image

Download Image

This example shows how to download a flow as an image with html-to-image .

<script lang="ts"> import { writable } from 'svelte/store'; import { SvelteFlow, Background, type Node, type Edge } from '@xyflow/svelte'; import '@xyflow/svelte/dist/style.css'; import { initialNodes, initialEdges } from './nodes-and-edges'; import DownloadButton from './DownloadButton.svelte'; const nodes = writable<Node[]>(initialNodes); const edges = writable<Edge[]>(initialEdges); const defaultEdgeOptions = { animated: true, type: 'smoothstep' }; </script> <div style="height:100vh;"> <SvelteFlow {nodes} {edges} {defaultEdgeOptions} fitView> <DownloadButton /> <Background /> </SvelteFlow> </div>
Last updated on