Skip to main content
Version: 8.1

Perspective - Menu Tree

Component Palette Icon:

Description​

The Menu Tree component can be configured to allow users to navigate pages in a Perspective Session. The Menu Tree defines a hierarchical view of information that can be configured to expand submenu branches and menu items. The subitems can be further expanded to expose more subitems if any exist, and collapsed to hide subitems.

Each menu item has its own path, for example, "Western Region/CA/San Jose" that determines its location in the Menu Tree. The Separation Character property (by default its forward-slash), dictates how the paths are broken up.

Properties​

Most Properties have binding options. For more information on Bindings, see Types of Bindings in Perspective. This section only documents the Props Category of properties. The other Categories are described on the Perspective Component Properties page.

NameDescriptionProperty Type
itemsConfigure items representing nodes in a subtree from this option. If defined, a submenu will branch from here with these options. Click to see the items properties.array
layoutAlignmentSpecifies which side of the root menu is aligned to. Submenu slides in from the opposite side.value: boolean
enabledIf true, this component is currently enabled to perform its actions.value: boolean
itemStyleSets style options for the menu tree component. You can also specify a style class.object
headerStyleSets style options for the menu tree component. You can also specify a style class.object
backActionStyleSets style options for the menu tree component. You can also specify a style class.object
backActionTextText to display in prompt to go back to the root menu. You can also specify a style class.value: string
styleSets a style for this component. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.object

items Properties​

NameDescriptionProperty Type
targetA url (external), or mounted path to a page. If "items" is empty (no subtree to this item), this will navigate to that location.value: string
itemsConfigure items representing nodes in a subtree from this option. If defined, a submenu will branch from here with these options.array
navIconIcon image appended to the right of the menu item.
  • path: Shorthand path to icon source, in format: library/IconName. The materials icon library is a the primary source for icons, see https://fonts.google.com/icons?selected=Material+Icons. Value is string.
  • color: Color of the icon. Can also assign the "fill" property in styles. Can be chosen from color wheel, chosen from color palette, or entered as RGB or HSL value. See Color Selector.
  • object
    labelMenu item label.
  • text: Text to display for this option. Value is string.
  • icon: Image icon added to the right of the label text.
  • object
    visibleWhether this option should be displayed in the menu tree.value: boolean
    enabledIf true, this option is currently enabled to perform its action or render its submenu.value: boolean
    showHeaderWhether to display this option's text as a header/title for its submenu.value: boolean
    styleSets a style for this item. Full menu of style options is available for text, background, margin and padding, border, shape and miscellaneous. You can also specify a style class.object
    resetOnClick
    New in 8.1.8
    While true, clicking on the item will cause the Menu Tree to reset back to its root level. Useful in cases where you want to provide your users with a quick way to return to the start of the menus.
    value: boolean
    backActionText
    New in 8.1.24
    Text to display in prompt to go back to the previous menu. This configuration property will override the text set to display in the root backActionText property. If left blank, menu items default to the root backActionText.
     value: string

    Scripting​

    See the Perspective - Menu Tree Scripting page for the full list of scripting functions available for this component.

    Examples​

    Example 1 - Basic Menu Tree​

    You can use links to go to URL links outside your project or internal to your project. For this example assume you have some screens defined in the project page configuration (home gear). Assume the URL's for those are as follows:

    • /screen_1
    • /screen_2
    • /screen_3
    • /screen_b
    • /screen_a1
    • /screen_a2
    note

    Images on the left side of the Menu Tree are associated with the label.icon.path Images on the right side of the Menu Tree are associated with the navIcon.path target property is the link to the screen to navigate to.

    Top Level Properties

    PropertyValue
    props.items.0.navIcon.pathmaterial/trending_flat
    props.items.0.navIcon.color#6C6C6C
    props.items.0.label.textMenu Numbers
    props.items.0.label.icon.pathmaterial/list
    props.items.0.label.showHeaderfalse
    props.items.1.navIcon.pathmaterial/trending_flat
    props.items.1.navIcon.color#008000
    props.items.1.label.textMenu Letters
    props.items.1.label.icon.pathmaterial/settings
    props.items.1.label.showHeadertrue
    props.items.2.navIcon.pathmaterial/stop
    props.items.2.navIcon.color#FF8A8A
    props.items.2.label.textNo Target Link
    props.items.2.label.icon.pathmaterial/stop_screen_sharing
    props.items.2.label.showHeadertrue

    Sub Level Properties of Item 0

    PropertyValue
    props.items.0.items.0.target/screen_1
    props.items.0.items.0.navIcon.pathmaterial/cloud
    props.items.0.items.0.navIcon.color#00D9D9
    props.items.0.items.0.label.textItem 1
    props.items.0.items.0.label.icon.pathmaterial/chat
    props.items.0.items.0.label.showHeadertrue
    props.items.0.items.1.target/screen_2
    props.items.0.items.1.navIcon.pathmaterial/cloud_queue
    props.items.0.items.1.label.textItem 2
    props.items.0.items.1.label.showHeadertrue
    props.items.0.items.2.target/screen_3
    props.items.0.items.2.navIcon.pathmaterial/cloud_circle
    props.items.0.items.2.label.textItem 3
    props.items.0.items.2.label.showHeadertrue

    Sublevel Properties of Item 1

    PropertyValue
    props.items.1.items.0.navIcon.pathmaterial/trending_flat
    props.items.1.items.0.label.textSub Menu A
    props.items.0.items.0.label.showHeadertrue
    props.items.1.items.1.target/screen_b
    props.items.1.items.1.navIcon.pathmaterial/data_usage
    props.items.1.items.1.label.textItem B
    props.items.1.items.0.items.0.target/screen_a1
    props.items.1.items.0.items.0.navIcon.pathmaterial/group
    props.items.1.items.0.items.0.navIcon.color#6C6C6C
    props.items.1.items.0.items.0.label.textItem A 1
    props.items.1.items.0.items.0.label.showHeadertrue
    props.items.1.items.0.items.1.target/screen_a2
    props.items.1.items.0.items.1.navIcon.pathmaterial/group_add
    props.items.1.items.0.items.1.navIcon.color#6C6C6C
    props.items.1.items.0.items.1.label.textItem A 2
    props.items.1.items.0.items.1.label.showHeadertrue

    Example 2 - Tree Navigation​

    The items property for this component is complex. It is an "object" type that has as many levels as you want. Here is an example of the JSON used to create the two level image above. You can copy the text below and paste it into the items property of your Menu Tree component. No code is needed to make this component navigate.

    This example assumes several things in order to work:

    • Target fields that are blank (HMI and Administration) do not navigate when clicked.
    • There are several pages created in the project:
      • /overview
      • /lines
      • /packaging
      • /userPermissions
      • /userEdit
    • There are icons stored in ignition.
      • A hamburger menu icon with a path of "menu_list"
      • A greater than symbol with a path of "chevron_right"
    items Property
    [
    {
    "target": "",
    "items": [
    {
    "target": "/overview",
    "items": [],
    "navIcon": {
    "path": ""
    },
    "label": {
    "text": "Overview",
    "icon": {
    "path": ""
    }
    },
    "showHeader": true
    },
    {
    "target": "/lines",
    "items": [],
    "navIcon": {
    "path": ""
    },
    "label": {
    "text": "Lines",
    "icon": {
    "path": ""
    }
    },
    "showHeader": true
    },
    {
    "target": "/packaging",
    "items": [],
    "navIcon": {
    "path": "Packaging"
    },
    "label": {
    "text": "Repeater",
    "icon": {
    "path": ""
    }
    },
    "showHeader": true
    }
    ],
    "navIcon": {
    "path": "chevron_right",
    "color": "#6C6C6C"
    },
    "label": {
    "text": "HMI",
    "icon": {
    "path": "menu_list"
    }
    },
    "showHeader": true
    },
    {
    "target": "",
    "items": [
    {
    "target": "/userPermissions",
    "items": [],
    "navIcon": {
    "path": ""
    },
    "label": {
    "text": "Edit Permissions",
    "icon": {
    "path": ""
    }
    },
    "showHeader": true
    },
    {
    "target": "/userEdit",
    "items": [],
    "navIcon": {
    "path": ""
    },
    "label": {
    "text": "Edit Users",
    "icon": {
    "path": ""
    }
    },
    "showHeader": true
    }
    ],
    "navIcon": {
    "path": "chevron_right",
    "color": "#6C6C6C"
    },
    "label": {
    "text": "Administration",
    "icon": {
    "path": "menu_list"
    }
    },
    "showHeader": true
    }
    ]