Skip to main content

<Controls />

The control panel contains a zoom-in, zoom-out, fit-view and a lock/unlock button. You can use it by passing it as a children to the ReactFlow component:


import ReactFlow, { Controls } from 'react-flow-renderer';

function FlowWithControls() {
return (
<ReactFlow nodes={[]} edges={[]}>
<Controls />

Prop Types

showZoombooleantrueDisplay zoom button
showFitViewbooleantrueDisplay fit view button
showInteractivebooleantrueDisplay interactive button
onZoomInfunctionundefinedcallback when the zoom-in button gets pressed
onZoomOutfunctionundefinedcallback when the zoom-out button gets pressed
onFitViewfunctionundefinedcallback when the fit-view button gets pressed
onInteractiveChange(isInteractive)functionundefinedcallback when the lock button is pressed
styleCSSPropertiesundefinedControls style attributes
classNamestringundefinedAdditional class name
  • Typescript: The interface of the Controls Prop Types are exported asControlProps.

Extended Controls

You can add buttons to the control panel by using the ControlButton component and pass it as a children to the Controls component:

import { Controls, ControlButton } from 'react-flow-renderer';

function CustomControls() {
return (
<ControlButton onClick={() => console.log('action')}>
<FancyIcon />
<ControlButton onClick={() => console.log('another action')}>
<AnotherFancyIcon />

ControlButton Prop Types

All props get forwarded to the ControlButton component.