> For the complete documentation index, see [llms.txt](https://docs.icraft.design/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.icraft.design/editor-features/navigation-bar/labs/tree-visualization.md). Agents can also search and read this documentation through its [MCP server](https://docs.icraft.design/~gitbook/mcp).

# Tree Visualization

iCraft supports rendering structural relationships using custom tree-structured data, making tree data intuitively visualizable.

***

## Syntax

Tree is a data format for describing tree structures, which uses JSON syntax. The main syntax rules are as follows:

* `name`: The **name of the node**, which must be **unique** within the tree.
* `type`: Defines the **element type of the node**, which determines how the node will be rendered visually.
  * If a node contains `children`, its `type` must be "area".
  * If the `type` value does not match any built-in graphic, a cube will be rendered instead.
* `children`: Optional, used to define an array of child nodes.
* `targets`: Optional, used to define connection targets (an array of target nodes' `name` values). Connections can be made to any node, not limited to sibling or parent-child relationships.

***

## Example

**Tree  Codes**

{% code lineNumbers="true" expandable="true" %}

```
{
  "name": "Terraform Project",
  "type": "area",
  "children": [
    {
      "name": "us-west-2",
      "type": "area",
      "children": [
        {
          "name": "aws_vpc",
          "type": "area",
          "children": [
            {
              "name": "aws_subnet.public",
              "type": "area",
              "children": [
                {
                  "name": "app_server",
                  "type": "Web Server",
                  "targets": ["aws_security_group"]
                }
              ]
            },
            {
              "name": "aws_internet_gateway",
              "type": "gateway"
            },
            {
              "name": "aws_route_table",
              "type": "area",
              "targets": ["aws_internet_gateway"]
            },
            {
              "name": "aws_security_group",
              "type": "area"
            }
          ]
        },
        {
          "name": "aws_route_table_association",
          "type": "Route53",
          "targets": ["aws_subnet.public", "aws_route_table"]
        }
      ]
    }
  ]
}
```

{% endcode %}

## Visualization in iCraft

<figure><img src="https://2043086618-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2Fqs5xBLyTN4cVMplr2ANM%2Fuploads%2F1KPFO5R9cGrrp0dq0lc0%2Ftree.png?alt=media&amp;token=525eb641-7fcc-441c-b7e3-2dda1638c3d6" alt=""><figcaption></figcaption></figure>
