Built-In Components
Svelte Flow comes with several additional components that you can plug into your flow. All
you have to do is import and add them as children to the SvelteFlow component.
<script>
import { SvelteFlow, MiniMap, Controls, Background, Panel } from '@xyflow/svelte';
import '@xyflow/svelte/dist/style.css';
</script>
<SvelteFlow>
<MiniMap />
<Controls />
<Background />
<Panel position="top-left">
<h1>My Flow</h1>
</Panel>
</SvelteFlow>MiniMap
The MiniMap provides a bird’s-eye view of your
flowgraph, making navigation easier, especially for larger flows. You can customize the
appearance of nodes in the minimap by providing a nodeColor function.
Controls
Svelte Flow comes with a set of customizable
Controls for the viewport. You can zoom in and
out, fit the viewport and toggle if the user can move, select and edit the nodes.
Background
The Background component adds a visual grid
pattern to your flowgraph, helping users maintain orientation. You can choose from
different pattern variants, or if you need more advanced customization, you can explore
the
source code
to implement your own pattern.
Panel
The Panel component allows you to add fixed overlays
to your flowgraph, perfect for titles, controls, or any other UI elements that should
remain stationary.