Skip to content

Application shell

The application shell is the outer frame of your Mateu application: the navigation sidebar or tab bar, the logo, the title, and the top-level menu structure.

It is defined by the @UI class (declarative API) or the AppSupplier class (fluent API).


Annotate a class with @UI to make it the application root:

@UI("")
@Title("My Backoffice")
@PageTitle("My Backoffice — Admin")
@Logo("/images/logo.svg")
@FavIcon("/images/favicon.png")
public class MyApp {
@Menu
Products products;
@Menu
Orders orders;
@Menu
@EyesOnly(roles = "admin")
AdminPanel admin;
}

AnnotationEffect
@UI("path")Declares the app root and its base path ("" = root)
@Title("text")Heading shown in the app shell (sidebar or header)
@Subtitle("text")Subheading shown below the title
@PageTitle("text")Browser tab <title> tag
@Logo("/path")Logo image shown in the shell header
@FavIcon("/path")Browser favicon
@DrawerClosedStart with the navigation drawer collapsed
@Style("css")Inline CSS on the app container
implements HomeRouteSupplierDefault landing route when the app loads (homeRoute() returns the path; without it, the app’s first menu item)

Use AppSupplier + AppShell.builder() for programmatic control:

public class AdminApp implements AppSupplier {
@Override
public AppShell getApp(HttpRequest httpRequest) {
return AppShell.builder()
.pageTitle("My Backoffice — Admin")
.title("My Backoffice")
.subtitle("Internal tools")
.logo("/images/logo.svg")
.favicon("/images/favicon.png")
.variant(AppVariant.MENU_ON_LEFT)
.homeRoute("/admin/home")
.menu(List.of(
new RouteLink("/home", "Dashboard"),
new RouteLink("/products", "Products"),
new RouteLink("/orders", "Orders"),
new Menu("/settings", "Administration", List.of(
new RouteLink("/users", "Users"),
new RouteLink("/config", "Configuration")
))
))
.build();
}
}
src/main/resources/specs/ui/routes.yaml
type: Routes
routes:
- route: admin
viewModel: com.example.AdminApp
PropertyEffect
pageTitleBrowser tab title
titleHeading in the shell header
subtitleSubheading below the title
logoLogo image URL
faviconBrowser favicon URL
variantLayout variant (see below)
homeRouteDefault landing route
drawerClosedStart with drawer collapsed
styleInline CSS on the app container
cssClassesCSS class names on the app container

AppVariantNavigation position
TABSTab bar at the top (what the default, AUTO, picks for a menu with no groups)
MENU_ON_LEFTCollapsible sidebar on the left
MENU_ON_TOPHorizontal nav bar at the top (AUTO’s pick for a menu with groups, ≤ 7 entries, one level deep, or one with remote menus)
HAMBURGER_MENUA hamburger button opening the whole menu in a drawer (AUTO’s pick for more than 7 top-level entries with groups)
HAMBURGER_SECTIONSThe hamburger holds the sections (first level) and a band under the header the entries of the section on screen; AUTO never picks it
TILESA top bar whose groups open as a hub of tiles (AUTO’s pick for a menu nested more than one level deep)
RAILA narrow icon rail on the left whose groups open a side panel

AUTO (the default) applies the rules in parentheses (AppMetadataExtractor.getVariant).


StyleConstants provides four ready-made style values:

import io.mateu.uidl.StyleConstants;
@Style(StyleConstants.CONTAINER) // max-width: 900px; margin: auto;
@Style(StyleConstants.FULL_WIDTH) // width: 100%;
@Style(StyleConstants.FULL_WIDTH_WITH_PADDING) // width: 100%; with side padding
@Style(StyleConstants.COMPACT) // the high-density preset @Compact applies

Or use arbitrary CSS:

@Style("max-width: 1200px; margin: auto;")

In the fluent API, getApp() receives the HttpRequest, so branding can be dynamic:

@Override
public AppShell getApp(HttpRequest httpRequest) {
String tenant = httpRequest.getHeaderValue("X-Tenant-Id");
TenantConfig config = tenantConfigService.get(tenant);
return AppShell.builder()
.title(config.appName())
.logo(config.logoUrl())
.favicon(config.faviconUrl())
.variant(AppVariant.MENU_ON_LEFT)
.menu(buildMenu(config))
.build();
}

From an action, use UICommand to change the favicon or window title without a full reload:

// Change favicon from an action
return UICommand.builder()
.type(UICommandType.SetFavicon)
.data("/images/alert-favicon.png")
.build();
// Change window title from an action
return UICommand.builder()
.type(UICommandType.SetWindowTitle)
.data("(3 alerts) My Backoffice")
.build();

The @UI class can implement WidgetSupplier to place components in the app header — the widgets slot on the right of the header bar (a user badge, a search box, a custom control). They do not fill the main area:

@UI("")
@Title("My Backoffice")
public class MyApp implements WidgetSupplier {
@Menu Products products;
@Menu Orders orders;
@Override
public List<Component> widgets(HttpRequest httpRequest) {
return List.of(
new Text("Signed in as Ada")
);
}
}

For home-page content — a welcome screen or a dashboard — make the home route a page of its own (a Dashboard or Welcome archetype) and name it with homeRoute. See Dashboard home page.


Log the user in with your framework’s security (Spring Security, Quarkus OIDC… — Mateu reads the principal it authenticates) and combine the shell with @EyesOnly:

@UI("")
@Title("My Backoffice")
public class MyApp {
@Menu
Products products; // visible to all authenticated users
@Menu
@EyesOnly(roles = "admin")
AdminPanel admin; // only visible to admins
}

See Security for details.


  • Dashboard home page — build KPI cards, charts, and activity feeds as the landing page
  • Navigation and menus — declare menu entries, sub-menus, route links, and remote menus
  • Security — where identity comes from, and @EyesOnly for role-based visibility

See it live in the Explorer: App shell variants · App header actions