svelte-mindmap

SvelteMindmap

SvelteMindmap is a svelte component for mindnode maps inspired by react-mindmap.

MIT License view on npm Svelte v3

svelte-mindmap

Installation

npm install --save svelte-mindmap

Usage

Bundler (Webpack, Rollup)

import Mindmap from 'svelte-mindmap';

let map = {
  title: null,
  nodes: [],
  connections: []
}

<Mindmap 
    map={map}
/>

Props

Prop Type Default Description
nodes Array [ ] Array of objects used to render nodes.
connections Array [ ] Array of objects used to render connections.
subnodes Array [ ] Array of objects used to render subnodes.
editable Boolean false Enable editor mode, which allows to move around nodes.

nodes

Array of objects used to render nodes. Below an example of the node structure.

{
  "text": "python",
  "url": "http://www.wikiwand.com/en/Python_(programming_language)",
  "fx": -13.916222252976013,
  "fy": -659.1641376795345,
  "category": "wiki",
  "note": ""
}

The possible attributes are:

connections

Array of objects used to render connections. Below an example of the connection structure.

{
  "source": "python",
  "target": "basics",
  "curve": {
    "x": -43.5535,
    "y": 299.545
  }
}

The possible attributes are:

subnodes

Array of objects used to render subnodes. The structure is the same as for nodes with two additional attributes:

Styling

Here’s a list of all CSS classes for styling:

Feedback would be much appreciated, questions, suggestions, issues are more than welcome.


If you like to support my open-source contributions and feeling generous, feel free to:

Buy Me A Coffee