React component for rendering mind maps
npm install react-mindmap
A React component for MindNode maps (or other mindmaps).
npm install react-mindmap --save
``js
import { Component } from 'react';
import { render } from 'react-dom';
import MindMap from 'react-mindmap';
import { nodes, connections } from './my-map.json';
class Example extends Component {
render() {
return (
connections={this.props.connections}
/>
);
}
}
render(
document.getElementById('target')
);
`
!img
``
git clone https://github.com/learn-anything/react-mindmap
cd react-mindmap
npm install && npm run test
and connect to http://localhost:3000/
``
npm run parse path/to/mindnode/maps path/to/converted/maps
`json`
{
"text": "python",
"url": "http://www.wikiwand.com/en/Python_(programming_language)",
"fx": -13.916222252976013,
"fy": -659.1641376795345,
"category": "wiki",
"note": ""
}
The possible attributes are:
- text: title of the node
- url: url contained in the node
- fx and fy: coordinates (if not present they'll be generated)
- category: category used to generate an emoji
- note: note that will be visible on hover
`json`
{
"source": "python",
"target": "basics",
"curve": {
"x": -43.5535,
"y": 299.545
}
}
The possible attributes are:
- source: title of the node where the connection starts
- target: title of the node where the connection ends
- curve.x and curve.y: coordinates of the control point of a quadratic bezier curve
(if not specified the connection will be straight)
- parent: title of the parent node
- color: used for the margin color, needs to be a valid CSS color
- .mindmap-svg: main svg element containing the map;foreignObject
- .mindmap-node: element representing a node;foreignObject
- .mindmap-node--editable: element representing a node in editor mode;foreignObject
- .mindmap-subnode-group-text: element containing all subnodes of a given node;div
- .mindmap-subnode-text: element containing a subnode;path
- .mindmap-connection: element for each connection;img` tag for emoji
- .mindmap-emoji: