diff --git a/examples/advanced/scripts/ExampleGraph.js b/examples/advanced/scripts/ExampleGraph.js
index 94948e0a..45071871 100644
--- a/examples/advanced/scripts/ExampleGraph.js
+++ b/examples/advanced/scripts/ExampleGraph.js
@@ -1,6 +1,6 @@
import React, { PureComponent } from 'react';
-import Graph, { isEdge, removeElements, getOutgoers, MiniMap } from '../../../src';
+import Graph, { isEdge, removeElements, getOutgoers, MiniMap, Controls } from '../../../src';
import SpecialNode from './SpecialNode';
import InputNode from './InputNode';
@@ -156,6 +156,7 @@ class App extends PureComponent {
return '#FFCC00';
}}
/>
+
- {this.state.graphLoaded && (
-
-
-
-
-
- )}
);
}
diff --git a/src/Plugins/Controls/index.js b/src/Plugins/Controls/index.js
new file mode 100644
index 00000000..de2654c4
--- /dev/null
+++ b/src/Plugins/Controls/index.js
@@ -0,0 +1,44 @@
+import React from 'react';
+import classnames from 'classnames';
+
+import { fitView, zoomIn, zoomOut } from '../../utils/graph';
+
+const baseStyle = {
+ position: 'absolute',
+ zIndex: 5,
+ bottom: 10,
+ left: 10,
+};
+
+export default ({ style, className }) => {
+ const mapClasses = classnames('react-flow__controls', className);
+
+ return (
+
+
+ +
+
+
+ -
+
+
+ @
+
+
+ );
+};
diff --git a/src/index.js b/src/index.js
index 492e447e..1a71539a 100644
--- a/src/index.js
+++ b/src/index.js
@@ -4,6 +4,7 @@ export default ReactFlow;
export { default as Handle } from './components/Handle';
export { default as MiniMap } from './plugins/MiniMap';
+export { default as Controls } from './plugins/Controls';
export {
isNode,
diff --git a/src/style.css b/src/style.css
index 920d851f..64ba8720 100644
--- a/src/style.css
+++ b/src/style.css
@@ -149,4 +149,19 @@
border: 1px dotted rgba(0, 89, 220, 0.8);
pointer-events: all;
}
+}
+
+.react-flow__controls-button {
+ background: #f8f8f8;
+ border: 1px solid #eee;
+ display: flex;
+ justify-content: center;
+ align-items: center;
+ width: 24px;
+ height: 24px;
+ cursor: pointer;
+}
+
+.react-flow__controls-button:hover {
+ background: #eee;
}
\ No newline at end of file