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.
Install the package using npm, yarn, or pnpm:
# Using npm npm install @clipmind/mindmap # Using yarn yarn add @clipmind/mindmap # Using pnpm pnpm add @clipmind/mindmap
Here is a basic example of how to create and export a mind map:
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>
);
}Full TypeScript support with comprehensive type definitions for a better development experience.
Choose from 6 different layout types to best visualize your ideas and data.
A rich library of color themes to match your brand or personal preferences.
Export your mind maps to SVG, PNG, or PDF formats with customizable options.
Choose from 6 different layout types to organize your mind maps:
Over 56 built-in color themes to customize your mind maps:
| Method | Description |
|---|---|
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. |
Ready to build mind maps in your project? Check out the full documentation for detailed API reference and more examples.
View Full Documentation