Skip to Content
πŸ“£ We just released Svelte Flow 1.0 Alpha β€” try it out and give us your feedback!

<Controls />

Source on GitHub 

The <Controls /> component renders a small panel that contain convenient buttons to zoom in, zoom out, fit the view, and lock the viewport.

<script lang="ts"> import { writable } from 'svelte/store'; import { SvelteFlow, Controls } from '@xyflow/svelte'; const nodes = writable([]); const edges = writable([]); </script> <SvelteFlow nodes={nodes} edges={edges}> <Controls /> </SvelteFlow>

Props

For TypeScript users, the props type for the <Controls /> component is exported as ControlsProps.

#position?
"bottom-left"
#showZoom?
boolean
true
#showFitView?
boolean
true
#showLock?
boolean
true
#fitViewOptions?
#buttonBgColor?
string
undefined
#buttonBgColorHover?
string
undefined
#buttonColor?
string
undefined
#buttonColorHover?
string
undefined
#style?
string
undefined
#class?
string
undefined
#orientation?
"horizontal" | "vertical"
"vertical"

Additionally, the <Controls /> component accepts any prop valid on a <div /> element.

Notes

Last updated on