Skip to main content

Tree Select

The Tree Select component displays checkboxes in a hierarchical tree that users can expand and collapse. Use it to let users pick one or more items from nested options, such as Continent > Country > City.

Data​

Property
Description
Expected Value
LabelText to display as the label for the component.String (e.g., Countries).

Options​

Allows you to add the hierarchical options for the Tree Select. You can click on Add new option to build the tree manually, or enable Dynamic options and provide the hierarchical structure using code.

When building options manually:

  • Click an option, or select Edit option from its menu, to edit its Option label, Option value, Selected, Expanded, Visibility and Disable fields. Selected checks the option by default, and Expanded expands it by default.
  • Click the + icon on an option (Create nested option) to add a nested option under it.
  • Select Delete option from an option's menu to remove it.
  • Drag options to reorder them.
info

Each option's value must be unique across the whole tree.

Example Schema for Dynamic Options​

When Dynamic options is enabled, enter the options in the Schema field using the following syntax:

{{[
{
label: 'Asia',
value: 'asia',
children: [
{
label: 'China',
value: 'china',
children: [
{ label: 'Beijing', value: 'beijing' },
{ label: 'Shanghai', value: 'shanghai' },
],
},
{ label: 'Japan', value: 'japan' },
{
label: 'India',
value: 'india',
children: [
{ label: 'Delhi', value: 'delhi' },
{ label: 'Mumbai', value: 'mumbai' },
{ label: 'Bengaluru', value: 'bengaluru' },
],
},
],
},
{
label: 'Europe',
value: 'europe',
children: [
{ label: 'France', value: 'france' },
{ label: 'Spain', value: 'spain', disable: true },
{ label: 'England', value: 'england' },
],
},
{ label: 'Africa', value: 'africa', visible: false },
]}}
  • children - An array of options in the same shape, nested to any depth.
  • visible - Set to false to hide an option. Hiding a parent also hides its entire branch.
  • disable - Set to true to prevent an option from being checked or unchecked.

With Dynamic options enabled, two more fields appear:

Property
Description
Expected Value
Selected valuesThe values of the options checked by default.Array of values (e.g., {{["asia", "spain"]}}).
Expanded valuesThe values of the options expanded by default.Array of values (e.g., {{["asia"]}}).

Allow Independent Selection​

Controls how checking an option affects its parent and children.

  • Off (default): Checking a parent checks all of its children. A parent is checked when all of its children are checked, and shows a partially checked state when only some of them are. Unchecking an option also unchecks its children and its parents.
  • On: Each option is checked or unchecked on its own, without affecting its parent or children.

You can enable or disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.

Events​

Event
Description
On changeTriggers whenever an option is checked or unchecked.
On checkTriggers whenever an option is checked.
On uncheckTriggers whenever an option is unchecked.
info

Check Action Reference docs to get detailed information about all the Actions.

Component Specific Actions (CSA)​

The following actions of the component can be controlled using the component-specific actions (CSA), you can trigger it using an event or use a RunJS query.

Actions
Description
How To Access
selectOptions( )Checks the options with the given values. The given values replace the current selection. Accepts an array or a single value.components.treeselect1.selectOptions(['asia', 'spain'])
deselectOptions( )Unchecks the options with the given values. Other checked options stay checked. Accepts an array or a single value.components.treeselect1.deselectOptions(['spain'])
setLoading( )Sets the loading state of the component.components.treeselect1.setLoading(true)
setVisibility( )Sets the visibility of the component.components.treeselect1.setVisibility(false)
setDisable( )Disables the component.components.treeselect1.setDisable(true)

Note: selectOptions() and deselectOptions() don't trigger the On change, On check or On uncheck events.

Exposed Variables​

Variable
Description
How To Access
checkedHolds the values of all checked options.{{components.treeselect1.checked}}
expandedHolds the values of all expanded options.{{components.treeselect1.expanded}}
checkedPathArrayHolds the path of each checked option as an array of values, from the root to the option.{{components.treeselect1.checkedPathArray[0]}}
checkedPathStringsHolds the path of each checked option as a string of values joined by -, for example asia-china-beijing.{{components.treeselect1.checkedPathStrings[0]}}
leafPathArraySame as checkedPathArray, but only for checked options that have no children.{{components.treeselect1.leafPathArray[0]}}
leafPathStringsSame as checkedPathStrings, but only for checked options that have no children.{{components.treeselect1.leafPathStrings[0]}}
isValidIndicates if the selection meets the validation criteria.{{components.treeselect1.isValid}}
isMandatoryIndicates if the field is required.{{components.treeselect1.isMandatory}}
isLoadingIndicates if the component is loading.{{components.treeselect1.isLoading}}
isVisibleIndicates if the component is visible.{{components.treeselect1.isVisible}}
isDisabledIndicates if the component is disabled.{{components.treeselect1.isDisabled}}

Validation​

Validation Option
Description
Expected Value
Make this field mandatoryDisplays a Field cannot be empty message if no option is checked.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Minimum selectionThe minimum number of options that must be checked. Displays Minimum N selections required if fewer are checked. 0 means no minimum.Number (e.g., {{2}}).
Maximum selectionThe maximum number of options that can be checked. Displays Maximum N selections allowed if more are checked. 0 means no maximum.Number (e.g., {{5}}).
Custom validationSpecifies a validation error message for specific conditions.Logical Expression (e.g., {{components.treeselect1.checked.length === 0 && "Select at least one country"}}).

Note: The selection count includes every checked option, parents included.

Additional Actions​

Action
Description
Configuration Options
Dynamic heightAutomatically adjusts the component's height based on its content.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Loading stateEnables a loading spinner, often used with isLoading to indicate progress.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
VisibilityControls component visibility.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Collapse when hiddenCollapses the component's space when it is hidden, so surrounding components fill the space. Takes effect when the app runs (preview or released app), not on the editor canvas.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
DisableEnables or disables the component.Enable/disable the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
TooltipProvides additional information on hover. Supports Plain text, Markdown, and HTML formats.String (e.g., Select one or more countries.).

Devices​

Property
Description
Expected Value
Show on desktopMakes the component visible in desktop view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.
Show on mobileMakes the component visible in mobile view.You can set it with the toggle button or dynamically configure the value by clicking on fx and entering a logical expression.

Styles​

Label​

Style
Description
Default Value
Text colorChange the color of the text in the component by providig the Hex color code or choosing a color from the picker.
Checkbox colorChange the color of the toggle switch in the component by providig the Hex color code or choosing a color from the picker.

Layout​

Label Property
Description
Configuration Options
ColorSets the color of the component's label.Select the color or click on fx and input code that programmatically returns a Hex color code.
SizeSets the font size of the label. Defaults to 12.Enter a number or click on fx and enter a code that programmatically returns a numeric value.
StyleChooses the label layout: New (default) or Legacy. Alignment, the direction and Width are only available with New.Select New or Legacy.
AlignmentSets the position of the label and the tree.Click on the toggle options or click on fx to input code that programmatically returns an alignment value - side or top. Use the direction icons to place the label on the left or right.
WidthSets the width of the label when it is on the side.Enable Auto width to use the standard width automatically. Disable it to manually adjust the width using the slider or by entering a numeric value via fx.

Switch​

Property
Description
Configuration Options
BorderSets the border color of the checkboxes.Select the color or click on fx and input code that programmatically returns a Hex color code.
Unchecked backgroundSets the background color of unchecked checkboxes.Select the color or click on fx and input code that programmatically returns a Hex color code.
Checked backgroundSets the background color of checked checkboxes.Select the color or click on fx and input code that programmatically returns a Hex color code.
CheckmarkSets the color of the checkmark.Select the color or click on fx and input code that programmatically returns a Hex color code.
Option textSets the color of the option labels.Select the color or click on fx and input code that programmatically returns a Hex color code.

Container​

Property
Description
Configuration Options
Box shadowSets the box shadow properties of the component.Select the box shadow color and adjust the related properties.
PaddingSets the padding around the component.Choose Default or None.

Advanced​

Property
Description
Configuration Options
CSS classAdds a custom CSS class to the component, which can be targeted using Custom Styles for advanced styling.Enter one or more class names.
info

The Advanced section is available only if your plan has the Custom Styles feature enabled.

info

Any property having fx button next to its field can be programmatically configured.