XML v2.0
Create a sidebar navigation that's more elaborate and dynamic.
As covered in Custom sidebar menu, XML v2.0 introduces a more modular and dynamic sidebar structure. The root <tree> now splits content into an optional set of asidepanel elements and a body, each with its own sections. The enhanced asidepanel also supports dynamic content loaded through HTTP requests and JSONPath parsing, which enables a more flexible and user-aware sidebar.
XML Syntax
The custom sidebar uses XML to map UI elements to code. This lets you create a sidebar tailored to a specific application.
The available XML elements and their hierarchy are:
├── tree
│ ├── asidepanel
│ │ ├── (Option A: static)
│ │ │ └── section
│ │ │ ├── menu
│ │ │ │ └── item
│ │ │ ├── link
│ │ │ ├── text
│ │ │ └── divider
│ │ ├── (Option B: dynamic using attributes)
│ │ │ └── [HTTP source + query + path → resolved into link]
│ └── body
│ └── home
│ └── section
│ ├── menu
│ │ └── item
│ ├── link
│ ├── text
│ └── dividerThese XML elements follow rules enforced by the editor. The editor also warns you about syntax errors:
The XML needs to start with:
<!DOCTYPE tree PUBLIC '-//UBIDOTS//DTD Menu XML V2.0//EN' "-">.The
<tree>element is mandatory. It must include at least one<body>element.<asidepanel>is optional, and you can add as many as needed.<asidepanel>can be static or dynamic. In dynamic mode, its content is loaded through HTTP and parsed based on the element attributes.The
<body>must have at least one<section>.<section>must have at least one<menu>or<link>.<menu>must have at least one<item>.
Here's a quick summary of the available elements and their attributes, but you can click the links and read more details:
tree
Parent element that wraps the body and optional asidepanel elements:
asidepanel
This element creates a static or dynamic, user-aware asidepanel.
These are the attributes of the asidepanel element:
id
Used to associate the asidepanel with the respective link or item elements that invoke it.
source
Ubidots API endpoint path or external URL from which the asidepanel content is retrieved dynamically through an HTTP request.
text
Title of the asidepanel. It supports JSONPath expressions, so it can change dynamically based on the HTTP response from source.
query
JSONPath expression used to parse the HTTP response from source. The result should render a list of strings or objects used as the asidepanel option content.
label
JSONPath expression used to select the label shown for options in the asidepanel. This expression is evaluated over each list element returned by query.
path
JSONPath expression used to build the path each option redirects to when clicked. This expression is evaluated over each list element returned by query.
permissions
Comma-separated list of permissions associated with the path. An end user only sees the asidepanel content if the permissions match.
The next two tabs show examples of static and dynamic asidepanels, both in XML and in the UI. For simplicity, these examples do not use permissions or tags. Refer to those sections to learn more about these two attributes.
This XML creates a fixed-content asidepanel. In this mode, the asidepanel works similarly to a body element and supports section, link, menu, item, text, and divider elements:
This creates the static asidepanel shown below. The two "Aside static" options in the sidebar come from the link and the item inside the body section.

This XML creates a dynamic-content asidepanel. In this mode, the asidepanel loads user-aware content through an HTTP request. In this example, it requests the Ubidots dashboards API endpoint. However, it could also request the URL of an UbiFunction where custom logic is applied based on the user loading the asidepanel. It then uses its JSONPath-enabled attributes to parse the response and render the asidepanel.
This creates the dynamic asidepanel shown below. The "Custom dashboards" option in the sidebar sends an HTTP request to /api/v2.0/dashboards/ and renders dynamic content by parsing the response with the configured attributes.

body
Element that wraps the sidebar content.
home
By default, clicking the application logo takes end users to the dashboards module at /app/dashboards/, usually to the last dashboard they viewed. By configuring this element, you can control the path or URL opened when each user clicks the application logo, based on permissions and tags.
These are the attributes of the home element:
path
Redirection path (see available paths here) or URL.
permissions
Comma-separated list of permissions associated with the path. An end user only sees the effect of the home element if the permissions match.
The example below shows two home elements, each pointing to a different dashboard. By using tags, one is shown to User1 and the other to User2.
section
This element creates groups of menu, link, text and divider elements within the sidebar or static asidepanel. The groups are separated by an optional text label.
These are the attributes of the section element:
text
Label or title of the section. It can be left empty, as in text="".
permissions
Comma-separated list of permissions associated with the path. An end user only sees the section if the permissions match.
Here's an XML example with 2 sections.

menu and item
These two elements help create menus within the sidebar or a static asidepanel.
Attributes by element
label
Label of the item.
panelTarget
ID of the asidepanel. If present, path is ignored.
path
Redirection path (see available paths here) or URL.
exact
Highlights the item when the current path exactly matches path. Query parameters are not included.
[true | false]
open
Open the link in the same tab or redirect. [tab | redirect]
permissions
Comma-separated list of permissions associated with the path. An end user only sees this item if the permissions match.
Here is an example of a menu and its items.

link
This element creates direct links within the sidebar or static asidepanel.
These are the attributes of the link element:
label
Label of the link.
panelTarget
ID of the asidepanel. If present, path is ignored.
path
Redirection path (see available paths here) or URL.
icon
Name of an icon from Font Awesome.
iconFaType
Font Awesome type. [duotone | classic]
iconFaStyle
Font Awesome style. [solid | regular | light | thin]
exact
Highlights the link when the current path exactly matches path. Query parameters are not included.
[true | false]
open
Open the link in the same tab or redirect. [tab | redirect]
permissions
Comma-separated list of permissions associated with the path. An end user only sees this link if the permissions match.
Here is an example of consecutive link elements.

text
Creates texts within the sidebar or static asidepanel.
These are the attributes of the text element:
type
Text type. [h1 | h2 | h3 | h4 | normal | bold]
Here is an example of consecutive text elements with different types.

divider
This element simply creates a horizontal line for visual separation. It does not have any attributes.

Permissions
Elements that support the permissions attribute only appear to end users whose assigned permissions match the element configuration.
The available permissions for each possible path that's exposed to the end users in the application are:
Devices
"/app/devices/"
"ubi_datasource.view_device"
Device groups
"/app/device-groups/"
"ubi_datasource.view_devicegroup"
Dashboards
"/app/dashboards/"
"ubi_dashboards.view_dashboardpg"
Events
"/app/events/"
"ubi_events.view_eventpg"
Reports
"/app/data-analysis/"
"ubi_data_analysis.view_report"
Organizations
"/app/organizations/"
"customuser.view_organization"
Users
"/app/organizations/users"
"customuser.view_user"
Filter elements by tags
Elements that receive the tags attribute add a visibility layer on top of the permissions assigned to an end user. This works by matching the user's tags with those specified in the element (learn more about tag filtering). If at least one tag matches, the element is visible to the user.
This tag-based filtering lets you customize the sidebar based on the user accessing the platform. For example, if you want to create a direct link that takes users to their own home dashboard, you can use XML like this:
Assume two end users, with tags tag1 and tag2, respectively. The XML includes two Home links. Since they use different tags, each Home link appears only to the matching user.
This previews the following sidebar. We have marked what each user would see:

Last updated
Was this helpful?