> 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).

# 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="/files/8MV28ge4Skk744bV4BXm" alt=""><figcaption></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.icraft.design/editor-features/navigation-bar/labs/tree-visualization.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
