Home

Awesome

VueMindmap

npm vue2

VueMindmap is a vue component for mindnode maps inspired by react-mindmap.

Live demo built on top of the awesome codesandbox.

<p align="center"> <img alt="vue-mindmap" src="https://raw.githubusercontent.com/anteriovieira/vue-mindmap/master/media/mindmap.png" /> </p>

Installation

npm install --save vue-mindmap

Usage

Bundler (Webpack, Rollup)

import Vue from 'vue'
import VueMindmap from 'vue-mindmap'
// You need a specific loader for CSS files like https://github.com/webpack/css-loader
import 'vue-mindmap/dist/vue-mindmap.css'

Vue.use(VueMindmap)
<template>
  <mindmap
    :nodes="nodes"
    :connections="connections"
    :editable="true"
  />
</template>

<script>
  export default {
    name: 'MyMindmap',
    data() {
      return {
        nodes: [...],
        connections: [...]
      }
    }
  }
</script>

Browser

<!-- Include after Vue -->
<!-- Local files -->
<link rel="stylesheet" href="vue-mindmap/dist/vue-mindmap.css"></link>
<script src="vue-mindmap/dist/vue-mindmap.js"></script>

<!-- From CDN -->
<link rel="stylesheet" href="https://unpkg.com/vue-mindmap/dist/vue-mindmap.css"></link>
<script src="https://unpkg.com/vue-mindmap"></script>

Props

PropTypeDefaultDescription
nodesArray[ ]Array of objects used to render nodes.
connectionsArray[ ]Array of objects used to render connections.
subnodesArray[ ]Array of objects used to render subnodes.
editableBooleanfalseEnable 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:

Development

Launch visual tests

npm run dev

Launch Karma with coverage

npm run dev:coverage

Build

Bundle the js and css of to the dist folder:

npm run build

License

MIT