Controls component provides UI controls for common Vue Flow interactions like zooming, fitting the view, and toggling interactivity.
Installation
Basic Usage
Props
Show zoom in/out buttons.
Show the fit view button.
Show the interactive toggle button (lock/unlock).
Parameters passed to the
fitView function when the fit view button is clicked.Position of the controls panel. Options:
'top-left''top-center''top-right''bottom-left''bottom-center''bottom-right'
Events
Fired when the zoom in button is clicked.
Fired when the zoom out button is clicked.
Fired when the fit view button is clicked.
Fired when the interactive state is toggled. The parameter indicates whether interactions are now active.
Slots
top
Content rendered at the top of the controls.
default
Content rendered at the bottom of the controls.
Control Button Slots
control-zoom-in
Custom zoom in button.
control-zoom-out
Custom zoom out button.
control-fit-view
Custom fit view button.
control-interactive
Custom interactive toggle button.
Icon Slots
icon-zoom-in
Custom icon for the zoom in button.
icon-zoom-out
Custom icon for the zoom out button.
icon-fit-view
Custom icon for the fit view button.
icon-lock
Custom icon for the locked state.
icon-unlock
Custom icon for the unlocked state.
Examples
Custom Position
Hide Specific Controls
Custom Fit View Params
Event Handling
Custom Control Buttons
Custom Icons
Additional Custom Controls
Styling
The Controls component uses CSS classes that can be customized:The interactive toggle button controls
nodesDraggable, nodesConnectable, and elementsSelectable states. When locked, all three are disabled.