Skip to main content
Version: 1.0.8

Tree

A generic, customizable tree. Author the nodes by hand with any icon, or bind a data hierarchy to it.

The Tree component as it renders with its default settings.The Tree component as it renders with its default settings.

Reach for it when you need:

  • A navigable equipment hierarchy
  • A structured picker driven by a query

Component name: TreeView · Category: Display

In the palette: A generic, customizable tree — author nodes with any icon, or bind a data hierarchy

Properties​

Any property can be bound to a tag, another component's property, or a query.

PropertyTypeDefaultDescription
sourceenumauthoredauthored = build the tree in the editor. data = map a bound array ({{query.tree}}) or static rows. Options: authored · data.
nodesarray[{"id":"n1","label":"Group A","icon":"Folder","children":[{"… (truncated)The tree nodes. Each has its own label, icon, colours and children.
  ↳ nodes.idstring""Stable id (auto-filled if blank).
  ↳ nodes.labelstringNew node—
  ↳ nodes.iconicon""Pick any icon from the library.
  ↳ nodes.iconColorcolor""—
  ↳ nodes.colorcolor""—
  ↳ nodes.badgestring""Optional trailing badge text.
  ↳ nodes.selectablebooleantrue—
  ↳ nodes.childrenarray[]—
    ↳ nodes.children.idstring""Stable id (auto-filled if blank).
    ↳ nodes.children.labelstringNew node—
    ↳ nodes.children.iconicon""Pick any icon from the library.
    ↳ nodes.children.iconColorcolor""—
    ↳ nodes.children.colorcolor""—
    ↳ nodes.children.badgestring""Optional trailing badge text.
    ↳ nodes.children.selectablebooleantrue—
    ↳ nodes.children.childrenarray[]—
      ↳ nodes.children.children.idstring""Stable id (auto-filled if blank).
      ↳ nodes.children.children.labelstringNew node—
      ↳ nodes.children.children.iconicon""Pick any icon from the library.
      ↳ nodes.children.children.iconColorcolor""—
      ↳ nodes.children.children.colorcolor""—
      ↳ nodes.children.children.badgestring""Optional trailing badge text.
      ↳ nodes.children.children.selectablebooleantrue—
      ↳ nodes.children.children.childrenarray[]—
        ↳ nodes.children.children.children.idstring""Stable id (auto-filled if blank).
        ↳ nodes.children.children.children.labelstringNew node—
        ↳ nodes.children.children.children.iconicon""Pick any icon from the library.
        ↳ nodes.children.children.children.iconColorcolor""—
        ↳ nodes.children.children.children.colorcolor""—
        ↳ nodes.children.children.children.badgestring""Optional trailing badge text.
        ↳ nodes.children.children.children.selectablebooleantrue—
        ↳ nodes.children.children.children.childrenarray[]—
          ↳ nodes.children.children.children.children.idstring""Stable id (auto-filled if blank).
          ↳ nodes.children.children.children.children.labelstringNew node—
          ↳ nodes.children.children.children.children.iconicon""Pick any icon from the library.
          ↳ nodes.children.children.children.children.iconColorcolor""—
          ↳ nodes.children.children.children.children.colorcolor""—
          ↳ nodes.children.children.children.children.badgestring""Optional trailing badge text.
          ↳ nodes.children.children.children.children.selectablebooleantrue—
dataarray[]Bind to {{query.tree}} or a static array. Nested (children[]) or flat (parentField).
idFieldstringid—
labelFieldstringname—
iconFieldstringiconRow field holding an icon-library name.
childrenFieldstringchildrenNested mode: the child array field.
parentFieldstring""Set for FLAT data: the field pointing at the parent id. Empty = nested.
selectionModeenumsingleOptions: none · single · multiple.
showSearchbooleanfalse—
showTreeLinesbooleantrueDraw the connector lines between parents and children.
defaultExpandedenumrootsOptions: none · roots · all.
indentnumber20Width (px) of each depth column.
rowHeightnumber28—
borderlessbooleanfalse—
truncatebooleantrueTruncate long labels with an ellipsis. Off = let the label overflow — then 'overflow' decides scroll vs clip.
overflowbooleantrueWhen 'truncate' is OFF: allow horizontal overflow — long labels scroll sideways instead of being clipped.
selectedItemobject{}Output (single): the selected node as { id, label, path, node }. Bind e.g. {{ <name>.selectedItem.label }}.
selectedItemsarray[]Output (multiple): the selected nodes as an array of { id, label, path, node }.
expandedIdsarray[]Output (bind from this): currently-expanded node ids.
stylestyle{}Custom CSS properties

Events​

Attach event actions to these in the Event Manager.

EventLabelGroupPayload
clickClickMouseThe DOM event.
dblclickDouble clickMouseThe DOM event.
contextmenuRight clickMouseThe DOM event.
mouseenterMouse enterMouseThe DOM event.
mouseleaveMouse leaveMouseThe DOM event.
nodeSelectNode selectTreeThe selected node.
nodeDoubleClickNode double clickTreeThe node.
nodeExpandNode expandTreeThe expanded node.
nodeCollapseNode collapseTreeThe collapsed node.
selectionChangeSelection changeTreeThe current selection.
Right-click behaves differently in the Designer

contextmenu fires your configured actions at runtime only — in LiveView and in preview. On the Designer canvas the right-click is captured to open the Event Manager, so testing it there will not run your actions. Test right-click in preview.

Notes​

To browse the tag namespace specifically, use Tag Browser instead.

Bound to a query Changed in 1.0.8​

  • It no longer blanks on a refresh. A query-bound tree used to show "No data" and then pop in, and blank again whenever any other binding on the widget re-settled. It now shows a skeleton on the first load only, and afterwards keeps the rows on screen behind a small loading pill until the new result lands. A refreshBinding after an insert adds the one new row; nothing else redraws, and what was expanded stays expanded.
  • A children column built by json_agg works. PostgreSQL hands it over as a JSON string, and a hierarchy nested that way was silently flattened to its roots. It is now parsed.
  • Duplicate ids no longer collide. Expanding one folder used to open its twin.
  • The selection follows the data. After a refresh, selectedItem no longer points at a node the data no longer has.

Ticking a folder Changed in 1.0.8​

With multi-select on, a folder selects as a folder: ticking it takes its whole subtree, unticking clears the subtree and the folders above it, and a folder's box shows checked, unchecked or indeterminate from the leaves below it. selectedItems lists the selection in the order the tree shows it.

Search keeps up on a tree of a few thousand nodes, and the search box can be cleared with its × or Escape.