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. Designed primarily for presentation; set readonly for view-only maps.

PropTypeDefaultDescription
dataMindElixirDataMap data. See the Data Structure page. Updates to this prop refresh the map content.
direction0 | 1 | 22Layout direction: 0 (Left), 1 (Right), 2 (Side/Both).
contextMenubooleantrueEnable right-click context menu.
keypressbooleantrueEnable keyboard shortcuts (Enter, Tab, etc.).
locale"en" | "zh_CN" | "zh_TW" | "ja" | "pt""en"Language for built-in menus and prompts.
overflowHiddenbooleanfalseClip map content that overflows the container.
theme"light" | "dark"Force a specific theme. If omitted, follows system/document theme.
monochromebooleanfalseUse a single-color branch palette that matches the theme foreground.
fitbooleantrueAutomatically fit map to view on load.
readonlybooleanfalseDisable editing. Recommended for presentation / embedded maps.
compactbooleanfalseTighter node spacing for dense presentation layouts.
markdown(text: string, obj) => stringCustom markdown parser. Topics are rendered as HTML through this function. Bring your own parser (e.g. marked) or a small custom one.
imageProxy(url: string) => stringRewrite remote node image URLs so they can be captured when exporting the map. Only needed to avoid CORS failures during image generation — not for normal on-screen display.
onChange(data: MindElixirData, operation: unknown) => voidCallback when map data changes due to an operation.
onOperation(operation: unknown) => voidCallback for each Mind Elixir operation event.
onSelectNodes(nodes: NodeObj[]) => voidCallback when nodes are selected.
loaderReactNodeCustom loading indicator shown before the map is ready.
classNamestringExtra class names on the outer wrapper.

For the shape of data, see Data Structure.

useMindMap

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

const { mind, isLoaded } = useMindMap();

Returns mind (MindElixirInstance) and isLoaded (boolean). For the full instance API (methods, events, data shape), see Mind Elixir Core.

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(file: Blob, filename: string) => voidCalled with the exported image blob and filename after export.
classNamestringExtra class names on the controls container.