Skip to content
Verified

Route

A navigable entry point, a menu of destinations, each pointing at the component that provides its content.

A Route defines a navigable surface of a Xuda app: a menu of destinations, each one a path or a label mapped to the Component that renders it. Routes live in their own branch of the Studio tree, separate from Programs and Database, and a single app can declare several, a public site, an admin dashboard, a mobile shell, each its own Route document.

Properties

studio_meta.parentId defaults to routes, the root of the Routes tree. Unlike Programs and Database, the Routes tree has no folder nesting, every Route sits directly under that root.

Every Route document lints as an error today

The checker's properties.menuType allowlist (CHK_MSG_OBJ_GEN_105) omits route, so every Route document raises "invalid properties.menuType" in the problem list even though check_route runs its own, real checks (CHK_MSG_RTE_MNU_010/020/030) right alongside it. It does not block saving or deploying a route, it is noise to expect and ignore in the checker output, not a sign the route is misconfigured.

routeMenu

Each entry in menu needs a prog_id naming the Component that provides its content, missing it, or naming a program the project does not have, is a checker error. Items can nest (children), and each carries display fields like bgColor / bgTextColor for its active state, filled in by the Routes editor.

Worked example

List the destinations

One menu entry per screen: a title, and the _id of the Component it opens.

Pick a default

default_menu_id names the entry shown when the route is first opened.

Point a Component at it

Most apps mirror the route as literal navigation UI too (tabs, a sidebar), each button's xu-on:click calling call_page with the target Component's id, so the route stays the source of truth and the UI stays in sync with it.

Under Routes in the Studio tree, add a route, then build its menu in the Routes editor: add an item, give it a label, and pick the Component it should open.

json
{
  "id": "student_app_route",
  "menuTitle": "Student Dashboard Route",
  "menu": [
    { "title": "Login", "prog": "app" },
    { "title": "Students", "prog": "student_classes" },
    { "title": "Tasks", "prog": "student_tasks" }
  ]
}

A route has no .xu source form, xuda-cli projects declare it as a .route.json5 file instead. Its friendly prog key compiles to routeMenu.menu[].prog_id in the Studio document.

json
{
  "properties": { "menuType": "route", "menuName": "Admin Dashboard" },
  "routeMenu": {
    "default_menu_id": "a1b2c3d4-…",
    "menu": [
      { "id": "a1b2c3d4-…", "prog_id": "97a_cmp_…", "bgColor": "#0f172a", "bgTextColor": "#f8fafc" },
      { "id": "b2c3d4e5-…", "prog_id": "97a_cmp_…", "bgColor": "#1e293b", "bgTextColor": "#e2e8f0" }
    ]
  }
}