Node Class

class Node

Represents a node in Mindmap diagram.

__construct(?string $id = null, ?NodeShape $shape = null)
Parameters:
  • $id (?string) – The node id (default: auto-generate the node ID)

  • $shape (?NodeShape) – The node shape - see node-shape for available shapes (default: default shape)

Returns:

A new instance of Node

Return type:

Node

addNode(Node ...$node)

Add additional child node(s) to the node

Parameters:
  • ...$node (Node) – Node(s)

Returns:

A new instance of Node with the node(s) added to the existing child nodes

Return type:

Node

withComment(string $comment)

Add a comment to the node

Parameters:
  • $comment (string) – The comment

Returns:

A new instance of Node with a comment

Return type:

Node

withIcon(string $icon)

Add an icon to the node (https://mermaid.js.org/syntax/mindmap.html#icons)

The icon pack must be available on the page rendering the diagram

Parameters:
  • $icon (string) – The icon definition

Returns:

A new instance of Node with an icon

Return type:

Node

withNode(Node ...$node)

Add child node(s) to the node

Parameters:
  • ...$node (Node) – Node(s)

Returns:

A new instance of Node with the node(s)

Return type:

Node

withStyleClass(string $styleClass)

Set the style class for the node

Parameters:
  • $styleClass (string) – The style class

Returns:

A new instance of Node with style class

Return type:

Node

withText(string $text, bool $isMarkdown = false)

Set the text displayed in node

If this method is not called, the node ID is used as the node text

Parameters:
  • $text (string) – The node text

  • $isMarkdown (bool) – Whether the text contains Markdown formatting

Returns:

A new instance of Node with the node text

Return type:

Node