Skip to content

Routes

@UI is the only routing annotation: it declares a mount (an app at a base path). The screens inside a mount are data, declared in a routes.yaml route registry (or supplied in code by a RouteEntrySupplier bean), and the home is the app’s first menu item unless the app class implements HomeRouteSupplier.

@UI("/orders")
public class OrdersApp implements HomeRouteSupplier {
@Override public String homeRoute() { return "/orders/list"; } // optional: the first menu item is the default
}
public class OrderList { ... }
src/main/resources/specs/ui/orders-routes.yaml
type: Routes
basePath: /orders
routes:
- route: list
viewModel: com.acme.OrderList

Routes in a route file are relative to the mount (list under basePath: /orders answers /orders/list). A specs/ui/routes.yaml with no basePath serves the root mount.

routes:
- route: invoices
viewModel: com.acme.InvoicePage
- route: bills
viewModel: com.acme.InvoicePage

A route nests under another through children (each flattened child carries its parent as RouteEntry.parent):

routes:
- route: orders/list
viewModel: com.acme.OrderList
children:
- route: ":id" # → orders/list/:id
viewModel: com.acme.OrderDetail

At runtime the request resolves as a route chain: the outermost level not yet on screen renders first and draws the child in its slot, so a reload or a deep link to the child lands inside its parent. See a record master whose tabs are pages.

Tip — nest detail routes under the listing route. Declaring the detail as orders/:id (instead of a sibling like order/:id) keeps the app shell’s navigation tab highlighted while the user drills into a record: the active tab is derived from the current route by longest prefix match, so /orders/42 keeps the Orders tab selected. The home route never wins by prefix.


See the route registry for the full format.