API Reference

Complete reference for the MindMap component and its props.

Component Anatomy

The standard way to use the MindMap component.

<MindMap data={initialData}>
  <MindMapControls />
</MindMap>

MindMap

The root component that initializes the mind map instance. It handles data loading, theme management, and event listeners.

PropTypeDefaultDescription
dataMindElixirDataInitial data for the mind map. Changes to this prop will update the map content.
direction0 | 1 | 21Layout direction: 0 (Left), 1 (Right), 2 (Side/Both).
draggablebooleantrueEnable node dragging.
contextMenubooleantrueEnable right-click context menu.
toolBarbooleanfalseShow the built-in toolbar (not recommended, use MindMapControls instead).
nodeMenubooleantrueShow menu when clicking a node.
keypressbooleantrueEnable keyboard shortcuts (Enter, Tab, etc.).
locale"en" | "zh_CN" | "zh_TW" | "ja" | "pt""en"Language for built-in menus and prompts.
theme"light" | "dark"Force a specific theme. If omitted, follows system/document theme.
fitbooleantrueAutomatically fit map to view on load.
onChange(data: MindElixirData) => voidCallback when map data changes.
onSelectNodes(nodes: NodeObj[]) => voidCallback when nodes are selected.

useMindMap

A hook that provides access to the MindElixir instance. Must be used within a MindMap component.

const { mind, isLoaded } = useMindMap();

Returns mind (MindElixirInstance) and isLoaded (boolean).

MindMapControls

Renders UI controls for the mind map (Zoom, Fit, Export, Fullscreen).

PropTypeDefaultDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right""top-right"Position of the controls overlay.
showZoombooleantrueShow Zoom In/Out buttons.
showFitbooleantrueShow Fit-to-Screen button.
showExportbooleantrueShow Export button.
onExport(type: string) => voidCallback after export is triggered.