npm
@clipmind/mindmap

NPM Package

Build mind maps directly in your JavaScript or TypeScript projects. The @clipmind/mindmap package provides a powerful and flexible API for creating, manipulating, and exporting professional mind maps.

Installation

Install the package using npm, yarn, or pnpm:

Terminalbash
# Using npm
npm install @clipmind/mindmap

# Using yarn
yarn add @clipmind/mindmap

# Using pnpm
pnpm add @clipmind/mindmap

Quick Start

Here is a basic example of how to create and export a mind map:

ExampleTypeScript
import { useEffect, useState } from 'react';
import { MindMapEditor, generateStore, loadFromMarkdown } from '@clipmind/mindmap';
import styled from 'styled-components';
import type { MindMapStore } from '@clipmind/mindmap';

const Container = styled.div`
  width: 100vw;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
`;

export function MindmapDemo() {
  const [store, setStore] = useState<MindMapStore | null>(null);

  useEffect(() => {
    // generateStore is async to ensure fonts are loaded before layout calculation
    generateStore().then(s => {
      loadFromMarkdown('# Hello World\n\n## Item 1\n### Item 1.1\n## Item 2', s);
      setStore(s);
    });
  }, []);

  if (!store) {
    return <Container>{'Loading...'}</Container>;
  }

  return (
    <Container>
      <MindMapEditor store={store} />
    </Container>
  );
}

Features

TypeScript Support

Full TypeScript support with comprehensive type definitions for a better development experience.

Multiple Layouts

Choose from 6 different layout types to best visualize your ideas and data.

56+ Themes

A rich library of color themes to match your brand or personal preferences.

Multiple Export Formats

Export your mind maps to SVG, PNG, or PDF formats with customizable options.

Available Layouts

Choose from 6 different layout types to organize your mind maps:

M
Mindmap
L
Logic
O
Org
T
Tree
F
Fishbone
TL
Timeline

Theme Library

Over 56 built-in color themes to customize your mind maps:

+44 more

Core API

MethodDescription
generateStore()Initialize a new MindMapStore instance.
loadFromMarkdown(md)Load mind map structure from markdown string.
addChildNode(parentId)Add a new child node to the specified parent.
deleteNodes(nodeIds)Delete nodes by their IDs.
setNodeText(nodeId, text)Update the text content of a node.
setLayout(type)Change the layout type of the mind map.
setTheme(name)Apply a color theme to the mind map.
saveSvg()Export the mind map as an SVG file.
savePng()Export the mind map as a PNG image.
savePdf()Export the mind map as a PDF document.

Get Started

Ready to build mind maps in your project? Check out the full documentation for detailed API reference and more examples.

View Full Documentation