# Tree

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-9ed84eb0e8e117861e2cd462b8a06e54034a09c4%2Fimage%20(19).png?alt=media" alt=""><figcaption></figcaption></figure>

## Basic

#### Tree Data

The JSON-formatted data that is served as the content of the widget. The format must depict the parent-child link among the values, allowing the widget to display in a tree format. The properties of the JSON content as below.

| Property        | Description                                                    |
| --------------- | -------------------------------------------------------------- |
| label           | Label for the node                                             |
| value           | Value for the node which must be unique for the entire content |
| children        | Array of children nodes                                        |
| disabled        | Make the node read-only                                        |
| selectable      | Specify if the node can be selectable                          |
| checkable       | Specify if the node can be checked, if the type is checkbox    |
| disableCheckbox | Make the node disable, when the type is checkbox               |

```json
[
  {
    "label": "Asia",
    "value": "asia",
    "children": [
      {
        "label": "China",
        "value": "china",
        "children": [
          {
            "label": "Beijing",
            "value": "beijing"
          },
          {
            "label": "Shanghai",
            "value": "shanghai"
          }
        ]
      },
      {
        "label": "Japan",
        "value": "japan"
      }
    ]
  },
  {
    "label": "Europe",
    "value": "europe",
    "disabled": true,
    "children": [
      {
        "label": "England",
        "value": "england"
      },
      {
        "label": "France",
        "value": "france",
        "checkable": false
      },
      {
        "label": "Germany",
        "value": "germany",
        "disableCheckbox": true
      }
    ]
  },
  {
    "label": "North America",
    "value": "northAmerica"
  }
]
```

## Validation

#### Required Field

Refers to the field that must be completed by the user, which means the field must be entered with a valid value before submitting the information.

#### Custom Rule

Apart from validating the entry using the regex rule, users can also use this property to write low-code and check other aspects. For example - check if the city selected in the previous field matches the desired value, throw a custom message to the user even before capturing the entry on this field.

## Interaction

#### Event Handlers

| Event                                         | Description                                                                                                                                                                                                                                                                                                                                                                                                                                                    |
| --------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| <mark style="color:blue;">**`Change`**</mark> | <p>The "Change" event is activated when the value of the widget is changed. When this event triggers, the associated action gets executed.<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-672dfcc7057f6d8ef62e8b3d953d6023b9a31a4c%2Fimage%20(315).png?alt=media" alt=""></p>                                                                                |
| <mark style="color:blue;">**`Focus`**</mark>  | <p>This event is triggered when the widget receives focus, meaning it becomes the active element that can accept user input.<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-3aec9c0873fdc0c399aae9ebffa29a05ecd8db27%2Fimage%20(313).png?alt=media" alt=""></p>                                                                                              |
| <mark style="color:blue;">**`Blur`**</mark>   | <p>This event occurs when the user shifts the focus out of the widget. This can happen in different scenarios, such as when a user clicks outside an input widget they were typing in or when the user tabs to another field.<br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-24927cfad5e62fe4a99996f099833454cba63d05%2Fimage%20(314).png?alt=media" alt=""></p> |

#### Hide

This sets whether the widget has to be displayed on the screen when the program is loaded. This shows/hides the widget both on desktop and mobile devices.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-4aaa812d0b623487c085a616219a4515138079fb%2Fimage%20(211).png?alt=media" alt="" width="338"><figcaption><p>Set the visibility</p></figcaption></figure>

#### Disabled

Disables the user interaction with the element on the page. It visually indicates that the element is inactive and prevents users from interacting with it when applied. Shows a red-crossed warning symbol and can be customized to disable the widget according to certain conditions using low-code.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-695f356d5e8bc58072102f50922157508eb6122b%2Fimage%20(224).png?alt=media" alt=""><figcaption><p>Read-only</p></figcaption></figure>

#### Select Type

| Property      | Description                                                                                      |
| ------------- | ------------------------------------------------------------------------------------------------ |
| No Select     | Hints the user has not selected any option from the tree-list                                    |
| Single Select | Allows the user to select only one option at a time                                              |
| Multi Select  | The users can pick more than one options from the list                                           |
| Checkbox      | Shows a checkbox as a prefix to each item on the list for the users to select using the checkbox |

#### Default Values

Indicate the specific value in the JSON packet that should be used to set the widget as the default value. This will ensure that the widget is loaded with the desired default value based on the specified JSON packet value.

## Layout

#### Expanded Values

Provide the JSON array of parent-child nodes which the user wants to display the nodes as the expanded list by default.

#### Default Expand All Nodes

Toggle this to make all the nodes on the list to be displayed as the expanded list of tree.

#### Show Line

This creates a line-link among the nodes, showing the parent-child relation explicitly.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-02f567f65f4bacf46f01af03f1d0d0353c8c20b3%2Fimage%20(382).png?alt=media" alt=""><figcaption></figcaption></figure>

#### Widget Tooltip

This tooltip pops up when the user moves the mouse over the input area of the widget. It is commonly used to hint at the type of input the user needs to provide.

The tooltip will be immediately shown when the user's mouse hovers over the widget, and immediately hides when the user's mouse leaves. This information will be contextual, useful, and informative.

<figure><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-41809efcb440627ed321a1612c40f3420ab29e6c%2Fimage%20(24).png?alt=media" alt=""><figcaption></figcaption></figure>

## Label

Represents the caption for the widget in the user interface. It is recommended to keep the label string short and convey the usage of the widget in the UI

#### Position

| Property | Description                                                                                                                                                                                                                                                                                 |
| :------: | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|  `Left`  | <p>Shows the label on the left side of the widget entry<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-04066cfc1022cfe859cd163b745939ef00a6a430%2Fimage%20(20).png?alt=media" alt=""></p> |
|   `Top`  | <p>Shows the label on top of the widget entry<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-00f015c4ad9b6203b50ba7784457ef5348f9d592%2Fimage%20(22).png?alt=media" alt=""><br></p>       |

#### Alignment

| Property | Description                                                                                                                                                                                                                                                                                                    |
| :------: | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|  `Left`  | <p>Align the text on the left corner of the label area<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-04066cfc1022cfe859cd163b745939ef00a6a430%2Fimage%20(21).png?alt=media" alt=""></p>                     |
|  `Right` | <p>Align the text on the right corner of the label area near the tree view<br><br><img src="https://125370873-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FzdpN2Lz0hzXpnNScDzVt%2Fuploads%2Fgit-blob-e750bcf0636fe425c1e24202a3962f6f783d2e54%2Fimage%20(23).png?alt=media" alt=""></p> |

## Style

<table><thead><tr><th width="218" align="center">Property</th><th>Description</th></tr></thead><tbody><tr><td align="center">Label</td><td>Set the colour for the label text. Recommended to set in contrast with the background.</td></tr><tr><td align="center">Background</td><td>Users can change the colour of the text background using this property. It has all the RGB colour ranges to pick from. It is recommended to use a corresponding background colour that shows the font clearly.</td></tr><tr><td align="center">Border Color</td><td>Set the colour to the border lines. The border lines will be shown only if that is enabled.</td></tr><tr><td align="center">Border Radius</td><td>This sets the radius of the widget's corners, enabling rounded corners on the widget. This value is defined in "px" terms.</td></tr><tr><td align="center">Text</td><td>Set the colour of the options' text. Recommended to set in contrast with the background.</td></tr><tr><td align="center">Validation Message</td><td>Set the colour of the validation text message. Recommended to set in contrast with the background, usually Red.</td></tr><tr><td align="center">Border Width</td><td>Set the thickness of the border of the widget using this value. It is defined using "px" terms.</td></tr><tr><td align="center">Margin</td><td>This value is set in terms of "px" number which creates the space between the border and the content of the widget.</td></tr><tr><td align="center">Padding</td><td>This value is set in terms of "px" number which creates the space between the border and outer elements.</td></tr></tbody></table>
