Installation
Don’t forget to import the styles:
import '@vue-flow/controls/dist/style.css'Usage
Props
Show zoom in/out buttons.
Show the fit view button that adjusts the viewport to fit all nodes.
Show the interactive toggle button that locks/unlocks node dragging and selection.
Parameters to pass to the
fitView function when the fit view button is clicked.Position of the controls panel on the canvas.Options:
'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right'Events
Emitted when the zoom in button is clicked.
Emitted when the zoom out button is clicked.
Emitted when the fit view button is clicked.
Emitted when the interactive toggle is clicked. Receives the new interactive state.
Slots
top
Content to display at the top of the controls panel.
control-zoom-in
Override the default zoom in button.
control-zoom-out
Override the default zoom out button.
control-fit-view
Override the default fit view button.
control-interactive
Override the default interactive toggle button.
icon-zoom-in
Override the zoom in icon.
icon-zoom-out
Override the zoom out icon.
icon-fit-view
Override the fit view icon.
icon-lock
Override the lock icon (shown when interactive).
icon-unlock
Override the unlock icon (shown when not interactive).
default
Additional content to display at the bottom of the controls panel.
Examples
Custom Position
Hide Specific Controls
Custom Controls with Slots
Handle Events
TypeScript
Exports
Controls- The main Controls componentControlButton- A styled button component for custom controlsControlProps- TypeScript interface for Controls props