FBoardMindMap
Facade for a structured mind map container.
Instances come from getMindMap(), insertMindMap(), or insertMindMap(). Do not construct this
class directly because it needs the active Board model and command service.
Access
Access through:
Setup
Register @univerjs-pro/boards-mind or a preset that includes it. In plugin mode, import @univerjs-pro/boards-mind/facade. Additional methods below require their listed plugin packages. See Facade setup.
@univerjs-pro/boards-mind
FBoardMindMap.getBounds
Gets this mind map's resolved Board-coordinate bounds.
The returned object is detached and safe to modify. Bounds include the implicit mind-map container padding and are suitable for collision checks, viewport decisions, or as a diagnostic before bounded reflow.
getBounds(): IBoardRect | nullReturns
Current resolved bounds, or null when the mind map no longer exists.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })if (!mindMap) throw new Error('Cannot insert mind map')const bounds = mindMap.getBounds()if (!bounds) throw new Error('Mind map no longer exists')console.log(`Mind map size: ${bounds.width} × ${bounds.height}`)Types: IBoardRect
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.getDescendants
Gets every non-root node in deterministic depth-first tree order.
getDescendants(): FBoardMindMapNode[]Returns
Descendant node facades, excluding the root.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA', children: [{ text: 'Automation' }] }] },})if (!mindMap) throw new Error('Cannot insert mind map')console.log(mindMap.getDescendants().map((node) => node.getText()))Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.getId
Gets the generated container element id.
getId(): stringReturns
Generated element id for integration event payloads.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })if (!mindMap) throw new Error('Cannot insert mind map')console.log(mindMap.getId())Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.getLayout
Gets a detached snapshot of this mind map's active layout.
getLayout(): IBoardMindMapFacadeLayout | nullReturns
Layout fields accepted by setLayout().
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })if (!mindMap) throw new Error('Cannot insert mind map')console.log(mindMap.getLayout())Types: IBoardMindMapFacadeLayout
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.getNode
Gets a node in this mind map by its generated element id.
getNode(nodeId: string): FBoardMindMapNode | nullParameters
nodeId— Required. Mind-map node element id.
Returns
Node facade, or null when it is missing or outside this mind map.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })const root = mindMap?.getRootNode()if (!mindMap || !root) throw new Error('Cannot insert mind map')console.log(mindMap.getNode(root.getId()))Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.getNodes
Lists nodes in Board z-order.
getNodes(): FBoardMindMapNode[]Returns
Node facades for this structured mind map.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] },})if (!mindMap) throw new Error('Cannot insert mind map')console.log(mindMap.getNodes().map((node) => node.getText()))Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.getRootNode
Gets the root node facade.
getRootNode(): FBoardMindMapNode | nullReturns
Root node, or null when the structured container is no longer valid.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })if (!mindMap) throw new Error('Cannot insert mind map')console.log(mindMap.getRootNode()?.getText())Types: FBoardMindMapNode
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.reflow
Rebalances, compacts when necessary, and centers this mind map inside a target rectangle.
Reflow operates on the mind map's managed nodes and connectors; it does not reflow unrelated children of a generic Board container. It also does not reparent the map into the target element. A successful call applies layout metadata, branch sides, node positions, connector routes, and centering atomically as one undo item.
Horizontal maps default to balanced right/left root branches when direction is omitted. The first attempt uses
requested or current gaps. Unless compact is false, a failed fit retries once with supported minimum gaps. V1
deliberately preserves node and text size. If that readable layout is still too large, no data changes and the
result reports bounds-too-small, requiredBounds, and the diagnostic scale ratio that would be needed.
reflow(options: IBoardMindMapFacadeReflowOptions): IBoardMindMapFacadeReflowResultParameters
options— Required. Target Board-coordinate bounds, optional inset, and optional layout overrides. Invalid values returninvalid-options; they do not throw or mutate the board.
Returns
Detached structured result suitable for headless and agent callers. Check success before using bounds
as the final geometry.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')// Create a visible region whose geometry will be used as the reflow target.const zone = board.insertShapes([ { id: 'release-zone', shapeType: univerAPI.Enum.ShapeTypeEnum.RoundRect, left: 80, top: 80, width: 1_000, height: 600, text: 'Release planning', },])?.[0]if (!zone) throw new Error('Cannot insert target zone')const mindMap = board.insertMindMap({ id: 'release-map', left: 180, top: 180, root: { text: 'Release', children: [ { text: 'Product', children: [{ text: 'Scope' }, { text: 'UX' }] }, { text: 'Engineering', children: [{ text: 'API' }, { text: 'QA' }] }, { text: 'Launch', children: [{ text: 'Docs' }, { text: 'Campaign' }] }, ], },})if (!mindMap) throw new Error('Cannot insert mind map')const targetBounds = board.getElementBounds(zone.id)if (!targetBounds) throw new Error('Cannot resolve target bounds')const result = mindMap.reflow({ bounds: targetBounds, padding: 24 })if (result.success) { console.log('Final mind-map bounds', result.bounds)} else if (result.reason === 'bounds-too-small' && result.requiredBounds) { console.warn('Target is too small', { requiredWidth: result.requiredBounds.width, requiredHeight: result.requiredBounds.height, diagnosticScale: result.scale, })} else { throw new Error(`Cannot reflow mind map: ${result.reason ?? 'unknown error'}`)}Types: IBoardMindMapFacadeReflowResult · IBoardMindMapFacadeReflowOptions
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.remove
Removes this complete structured mind map through the root-node delete operation.
Nodes, managed connectors, and the mind-map container are removed together in one collaborative undo item.
remove(): booleanReturns
true when the mind map exists and removal succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release' } })if (!mindMap || !mindMap.remove()) throw new Error('Cannot remove mind map')Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.setBranchLineType
Changes only the branch routing style and recomputes managed connectors.
setBranchLineType(branchLineType: MindMapBranchLineType): booleanParameters
branchLineType— Required. New branch routing style.
Returns
true when the operation succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] },})if (!mindMap || !mindMap.setBranchLineType(univerAPI.Enum.BoardMindMapBranchLineType.Curve)) { throw new Error('Cannot update branch style')}Types: MindMapBranchLineType
Package: @univerjs-pro/boards-mind · Type definitions
FBoardMindMap.setLayout
Updates this mind map's layout configuration and recomputes all managed node and branch geometry.
setLayout(options: IBoardMindMapFacadeLayoutOptions): booleanParameters
options— Required. Layout fields to change. Omitted fields keep their current value.
Returns
true when the operation succeeds.
Examples
const board = univerAPI.getActiveBoard()if (!board) throw new Error('No active board')const mindMap = board.insertMindMap({ left: 120, top: 120, root: { text: 'Release', children: [{ text: 'QA' }] },})if (!mindMap || !mindMap.setLayout({ direction: 'right', horizontalGap: 180 })) { throw new Error('Cannot update mind-map layout')}Types: IBoardMindMapFacadeLayoutOptions
Package: @univerjs-pro/boards-mind · Type definitions
How is this guide?