YAML UI Definition
Mateu can render a page defined entirely in a YAML file — no Java class required.
When the framework receives a request for a route that has no matching Java class, it looks for a YAML file in the classpath and uses it to build the component tree automatically.
How it works
Section titled “How it works”- A request arrives for route
my-app/my-page. - Mateu finds no Java view model bound to that route (a
@UImount or aroutes.yamlentry). - Mateu looks for
specs/ui/my-app/my-page.yamlin the classpath. - If found, it deserializes the file into a component tree and renders it.
- If not found, Mateu falls back to “Not found”.
File location
Section titled “File location”Place YAML files under src/main/resources/specs/ui/, mirroring the route structure:
| Route | YAML file |
|---|---|
hello | src/main/resources/specs/ui/hello.yaml |
demo/hello | src/main/resources/specs/ui/demo/hello.yaml |
admin/users/list | src/main/resources/specs/ui/admin/users/list.yaml |
File format
Section titled “File format”Every YAML file must have a root type field that names the component to render. All nested components also need a type.
type: VerticalLayoutspacing: truepadding: truecontent: - type: Text text: "Hello from YAML!" container: h1 - type: Text text: "This page was defined in a YAML file, without any Java class." - type: HorizontalLayout spacing: true content: - type: Button label: "Save" actionId: save buttonStyle: primary - type: Button label: "Cancel" actionId: cancel buttonStyle: secondary - type: FormLayout content: - type: FormField id: name label: "Name" dataType: string required: true - type: FormField id: email label: "Email" dataType: string stereotype: email - type: FormField id: birthDate label: "Birth date" dataType: dateA HorizontalLayout with no spacing: key is spaced (an image beside a form, two cards side
by side never touch); write spacing: false to set its children flush. A VerticalLayout is not
spaced unless it says spacing: true. The same default applies on every backend (Java, .NET,
Python) and in a static bundle.
Page type — pageType:
Section titled “Page type — pageType:”A page has a coarse page type — landing, collection, detail, form, process or
dashboard (the Redwood page-template families). It sets the page’s default width (collection and
dashboard pages are full width; form, process and landing pages are capped; detail pages defer to
their content — see page width) and is
stamped on the rendered page as data-page-type. A Java view declares it with
@PageTemplate(PageType.X); a YAML page declares it with a top-level pageType: key, beside
layout: (or beside type: in a bare tree):
pageType: landinglayout: type: VerticalLayout content: - type: HeroSection title: Welcome- Declared, it wins over the type inferred from the content or from a bound
viewModel:— the same precedence as@PageTemplate(and, like the definition’slayout:, over a@PageTemplateon the view model it binds, since the definition is the more specific of the two). - Absent, nothing changes: the type is inferred as before.
- Matched without regard to case; an unknown value is ignored (and logged), so a typo never costs the page.
- It reaches the wire on every path — served by Java, .NET or Python, pre-rendered into a static
bundle, or expanded in the browser from a
specsOnlybundle — and every renderer (Vaadin, Redwood) reads it from there.
The New › Mateu › Page… templates (IntelliJ and VS Code) already write the right one: Welcome and
Hero Search → landing; Listing, Smart Search, To-do List, Calendar, Collection Detail and the
grid-like pages → collection; General/Item Overview, Foldout and Gantt → detail; Dashboard →
dashboard; Wizard step → process; Form → form. The blank layout leaves it to inference.
Page header — type: Form
Section titled “Page header — type: Form”A page’s header lives on its type: Form node: title, subtitle, avatar, header,
toolbar, buttons, footer, noHeader — and every other element a Java page gets from its
annotations and suppliers, now authorable as data. The keys in the table below are
experimental (@Experimental("YAML page header (3.0 beta)") on the Form record): their names
and shapes may still change before they are declared stable.
| Key | Shape | Java twin |
|---|---|---|
overline | text above the title | @Overline / OverlineSupplier |
titlePlaceholder | what the header shows while the title is empty | @TitlePlaceholder |
timestamp | the “last updated” line under the subtitle | @Timestamp field |
badges | list of {label, color} chips | @BadgeInHeader / HeaderBadgesSupplier |
kpis | list of {label, value} key facts | @KPI |
peerNav | {prevLabel, prevRoute, nextLabel, nextRoute} | PeerNavigationSupplier |
confirmOnNavigationIfDirty | true: ask before leaving with unsaved changes | @ConfirmOnNavigationIfDirty |
recordSwitcher | {label, value, type, searchable, disabled, options | optionsSource, route | actionId} | RecordSwitcherSupplier |
banners | list of {theme, title, description, closeable, timeoutSeconds} | @Banner / BannerSupplier |
fabs | list of {icon, label, actionId, order, buttonStyle} | @Fab methods on the page |
type: Formtitle: ${state.name}overline: CustomerstitlePlaceholder: New customer…timestamp: Last updated ${state.updatedAt}badges: - {label: "${state.status}", color: success} # blank once interpolated → hiddenkpis: - {label: Balance, value: "${state.balance}"}peerNav: {prevLabel: Previous, prevRoute: "customers/${state.prevId}", nextLabel: Next, nextRoute: "customers/${state.nextId}"}recordSwitcher: label: Customer value: ${state.id} searchable: true optionsSource: {ref: customers, itemsPath: content, valuePath: id, labelPath: name} route: customers/${state._record} # the picked value is ${state._record}banners: - {theme: WARNING, title: Overdue, description: "Two invoices are overdue", closeable: true}fabs: - {icon: "vaadin:plus", label: New order, actionId: newOrder}content: [...]A page that edits should declare confirmOnNavigationIfDirty: true: without it, a menu click or a
previous/next arrow discards what was typed, with no warning. A REST action that succeeds settles
those changes when it declares validationRequired or a successRoute, so saving never asks.
A peerNav route is an app route, relative to the mount; one starting with / is a path of the site
(another mount, say), which the browser loads. When a neighbour can be missing, say so in
the expression and that side is disabled, or left out where the template has no disabled state:
nextRoute: "${state.nextId ? 'customers/' + state.nextId : ''}". Which record comes next is the
data’s business: have the endpoint return the ids beside each record, in the list’s own order, rather
than computing id + 1. The demos do this (previousId and nextId).
- Dynamic values use the idioms every YAML text already has:
${state.x}and${data.x}(the route’sdata:source feedsdata), interpolated by the renderer. A badge whose text interpolates to blank is hidden — the same switch a@BadgeInHeaderString field gives. - The record switcher’s entries are either listed (
options: [{value, label, description}]) or fetched by the browser from a REST source (optionsSource:, usually asources.yamlreference, read with itsitemsPath/valuePath/labelPath— like a select field’s options). A pick navigates toroute(with${state._record}= the picked value), or, without a route, dispatchesactionId(default_switchRecord) with the value in_record— a pageactions:entry or a view model method can take it from there. The source is fetched directly by the browser, so aproxy: truesource does not serve a switcher. - Banner themes are
INFO,SUCCESS,WARNING,DANGER(upper case). - FABs dispatch their
actionIdlike any button: an action the page declares inactions:, an action-catalogue entry, or a method of the bound view model. They stack byorder(ties keep the list order);buttonStyledefaults toprimary. - They reach the wire with the same field names a reflected Java page’s header has (
overline,titlePlaceholder,timestamp,badges,kpis,peerNav,switcher,banners,fabs), so every renderer draws them alike — served by Java, .NET or Python, pre-rendered into a static bundle, or expanded in the browser from aspecsOnlybundle. - Redwood draws every one of them, for a YAML page and a Java page alike: KPIs, subtitle,
switcher (listed or from a direct source;
routepicks navigate), banners and FABs, and on itsoj-sppage header the status badge (the first header badge — the rest follow the subtitle, and a badge whose label resolves blank is not drawn), the previous/next arrows (a side with no route is drawn disabled; both empty, no arrows), the timestamp (the header’s own “last updated” element when the value is a date —2026-10-12T10:42— otherwise the text ends the subtitle line), the overline above the title and the title placeholder (dimmed, only while the title resolves empty).
Page templates — template:
Section titled “Page templates — template:”A page either fills a template or is free. A free page (no template:) lays its content
out as written. A page with a template: fills one of the design system’s page templates — the
Redwood templates, as Oracle’s Spectra ships them — and gives only what that template asks for:
its fields and its slots, named as the template names them. The template decides the look
(colours, surfaces, spacing, the shape and size of an image); the page never styles it.
In atomic-design terms the template is the template level, and your YAML page — the template
filled with the record’s data (${state.x}) — is the page.
template.type | Redwood template | Fields | Slots |
|---|---|---|---|
FoldoutPage | oj-sp-foldout-layout (as a page) | orientation (vertical/horizontal) | overview (always in view); the form’s content is the panels — FoldoutPanels with title, summary (what the folded strip shows), open (no open: = open while it fits the row, folded when it does not) |
GeneralOverviewPage | oj-sp-general-overview-page | — | info (the complementary side panel); the form’s content is main. The header — title, recordSwitcher, kpis (contextual info), timestamp, toolbar — is the form’s |
GuidedProcessPage | oj-sp-guided-process | steps (GuidedProcessStep: id, title, description, content) | — (the steps hold the content). The form’s title/subtitle are the process’s; its toolbar’s primary is the process’s primary action, its cancel the way out. All steps are ONE form: moving between them keeps what was typed, no round trip |
HeroSearchPage | oj-sp-hero-search-page | backgroundColor (other renderers’ hero) | the form’s content is the results (a searchable Listing); the form’s title and subtitle are the hero’s. On Redwood the page opens as the landing hero and turns into the collection view on the first search |
ItemOverviewPage | oj-sp-item-overview-page + oj-sp-item-overview | avatar {src, initials} (round) or photo {src} (4:3) | body, footer (the overview panel); the form’s content is main |
AdvancedCreateEditPage | the advanced create/edit page as Redwood composes it (oj-sp-header-create-edit + oj-sp-sections + the vertical anchor navigator) | — | detail (contextual data beside the form; it excludes the anchor navigator); the form’s content is main (the sections). The header is the form’s: a toolbar with a cancel (actionId: cancel-new/cancel-edit/cancel) and the primary action |
CollectionDetailPage | oj-sp-collection-detail-page | — | list (the collection — typically a Listing with a rowRoute, often a partial shared by two pages), noSelection; the form’s content is the selected item’s detail (detailTemplate): a page with content has a selection, one without shows noSelection |
DataManagementPage | oj-sp-data-management-page | end, bottom (DockedPanel: id, title, content, size, open — shown while open; a YAML page has no server to toggle them) | the form’s content is the data view (a Listing, a grid…); its toolbar sits over the data; its title heads the page |
DashboardLandingPage | oj-sp-dashboard-landing-page | — | kpi (the scoreboard’s MetricCards); the form’s content is the main area (one DashboardPanel per chart or list) |
MultimediaContentPage | composed: oj-sp-header-welcome-banner + sections + the vertical anchor navigator (Spectra ships no oj-sp-multimedia-content-page in 2604) | backgroundColor (as WelcomePage) | the form’s content is the sections (Card + mateu-section); the banner is the form’s title/subtitle/overline/toolbar |
WelcomePage | oj-sp-welcome-page | backgroundColor (Spectra’s dark-ocean … dark-sienna, or the bare tone; auto/none = default) | the form’s content is the default slot (the tiles under the banner) |
The rest of the template comes from the type: Form that carries it: its title/subtitle are
the item’s (itemTitle/itemSubtitle), its first header badge the item’s badge, its peerNav the
previous/next item, its back button the parent link, its primary toolbar button the panel’s edit
action when it edits (otherwise it joins the panel’s other actions, like the rest of the toolbar).
A WelcomePage draws the page’s header itself: the form’s title is the banner’s title, its
subtitle the description, its overline the line above the title and its toolbar the calls to
action (a primary one first) — the form shows no header or toolbar of its own.
type: Formtitle: Star Warsoverline: A Mateu demosubtitle: Characters, planets and starships of the saga.toolbar: - {type: Button, label: Browse the characters, buttonStyle: primary, actionable: {type: RouteLink, route: people}}template: type: WelcomePage backgroundColor: dark-slatecontent: # the tiles under the banner - type: DashboardLayout items: - {type: DashboardPanel, title: Characters, content: {type: Text, text: Who is who.}}An item overview:
type: Formtitle: ${state.name}subtitle: Charactertoolbar: - {type: Button, actionId: backToList, label: Back to People, actionable: {type: RouteLink, route: people}} - {type: Button, label: Edit, buttonStyle: primary, actionable: {type: RouteLink, route: "people/${state.id}/edit"}}template: type: ItemOverviewPage avatar: {src: "${state.image}"} body: - {type: FormField, id: gender, label: Gender, readOnly: true, propertyRow: true} - {type: FormField, id: homeworldName, label: Homeworld, readOnly: true, propertyRow: true}content: # the template's main slot - type: TabLayout tabs: - type: Tab label: Physique content: {type: FormField, id: height, label: Height (cm), readOnly: true, propertyRow: true}- Redwood paints the template itself (
oj-sp-item-overview-page), with nothing of ours on top of it. Amainslot that is one tab bar becomes the template’s tabs; anything else is shown as it is. - Every other renderer (Vaadin, React Native, IntelliJ) gets the template laid out as ordinary
components — Mateu’s own drawing of it: the overview panel pinned on the left, the main slot on
the right, wrapping under it on a narrow screen. Each slot travels in a container named after it
(
item-overview-body,item-overview-footer,item-overview-main) and the template’s own values on the form (template: {type, avatar, photo}). - It works served by the Java backend, pre-rendered into a static bundle and expanded in the
browser from a
specsOnlybundle. The .NET and Python YAML builders do not readtemplate:yet. template:is experimental (@Experimental("page templates (3.0 beta)")). The eleven templates in the table above are available; the IDEs’ Item Overview page template writestemplate:for you.- Demo: the record pages of
demo/demo-starwars(person.yaml,planet.yaml,film.yaml…).
Available types
Section titled “Available types”Every component type has a row in the component list
— generated from the catalogue the build produces, with a one-line description, its main attributes
and a link to the page that explains it. Use the exact type name as the type value. A few to start
with:
Layout components: VerticalLayout, HorizontalLayout, FormLayout, TabLayout, SplitLayout, MasterDetailLayout, AccordionLayout, BoardLayout, CarouselLayout, Grid, …
Content components: Text, Markdown, Image, Icon, Badge, KPI, Chart, ProgressBar, Anchor, Bpmn, Workflow, …
Input components: FormField, CustomField, FormSection, FormRow, …
Action components: Button, Dialog, ConfirmDialog, …
Navigation: RouteLink, Menu, Directory, Breadcrumbs, …
The complete list of types and their fields is in the JSON Schema:
https://raw.githubusercontent.com/miguelperezcolom/mateu/refs/heads/master/backend/shared/uidl/uidl-schema.json
IntelliSense setup
Section titled “IntelliSense setup”The project ships a JSON Schema at https://raw.githubusercontent.com/miguelperezcolom/mateu/refs/heads/master/backend/shared/uidl/uidl-schema.json.
Connecting your editor to it gives you autocompletion, field validation, and documentation tooltips while editing YAML files.
VS Code
Section titled “VS Code”Option A — workspace settings (recommended)
Install the YAML extension by Red Hat, then add this to .vscode/settings.json:
{ "yaml.schemas": { "https://raw.githubusercontent.com/miguelperezcolom/mateu/master/backend/shared/uidl/specs-schema.json": "src/**/specs/ui/**/*.yaml" }}This activates IntelliSense for every *.yaml file under any specs/ui/ directory in the project.
specs-schema.json is the unified schema — a oneOf of every file kind (pages, type: Routes,
type: UI mounts, sources.yaml, project.yaml…), so a routes or sources file validates too; the
component catalogue uidl-schema.json alone would flag those as invalid.
Option B — per file
Start the file with a $schema key (the loaders ignore it; this is what the starters do), or with the
YAML language server’s comment:
$schema: https://raw.githubusercontent.com/miguelperezcolom/mateu/master/backend/shared/uidl/specs-schema.jsontype: VerticalLayout...# yaml-language-server: $schema=https://raw.githubusercontent.com/miguelperezcolom/mateu/master/backend/shared/uidl/specs-schema.jsonspecs-schema.json fits every file kind — a bare component tree, a page with a layout: envelope,
routes, sources, project settings. uidl-schema.json covers a bare component tree only and rejects a
layout: page.
Neither the schema nor the loader rejects an unknown key (a misspelt titel: is ignored), so a
typo shows as a missing feature, not an error. A file the loader cannot read at all makes its route
answer Not found; the reason is in the server log (WARN Could not read the definition …) and,
with -Dmateu.dev=true, on the page.
IntelliJ IDEA
Section titled “IntelliJ IDEA”- Open Settings (
⌘,/Ctrl+Alt+S). - Go to Languages & Frameworks → Schemas and DTDs → JSON Schema Mappings.
- Click + to add a new mapping.
- Fill in:
- Name:
Mateu UIDL - Schema file or URL:
https://raw.githubusercontent.com/miguelperezcolom/mateu/refs/heads/master/backend/shared/uidl/specs-schema.json(the unified schema of everyspecs/uifile kind) - Schema version:
JSON Schema version 7
- Name:
- Under File path pattern, click + and enter:
specs/ui/**/*.yaml - Click OK.
IntelliJ will now provide autocompletion and validation for all YAML files under specs/ui/.
Tip: If IntelliJ shows a yellow bar saying “Schema is not applied”, make sure the file path pattern matches — use
specs/uiwithout a leading slash.
Partials
Section titled “Partials”A YAML file under specs/ui/partials/ is not a page but a partial — one component, or a list
of them, usable anywhere a component is:
- type: Partial ref: address-blockSee Partials.
layoutDelta: — keep inference alive
Section titled “layoutDelta: — keep inference alive”A page can carry a layoutDelta: instead of a layout:. The difference matters more than it
looks:
viewModel: com.acme.ContactlayoutDelta: order: [email, name] hidden: [internalNote] overrides: name: { label: "Full name", colspan: 2 }Vocabulary: the key that names the view model is
viewModel:(the noun of the 5-noun model).
A layout: is a snapshot: it takes the screen out of the inference regime for good, because
explicit always wins. Add a field to the model afterwards and it does not appear; rename one and the
layout points at a ghost.
A layoutDelta: records what a human decided, anchored to field ids. Inference still runs on
every request and the delta is re-applied on top, so a field the model grows later lands in its
inferred place, and one it loses is an entry that simply matches nothing.
What a delta deliberately cannot express is arbitrary restructuring — “wrap these two in a card inside a tab”. Anchoring to ids is exactly what makes it survive a model change; a delta that could rebuild the tree freely would be a snapshot with a different name.
The delta is re-applied to the tree inference produced on every request — that is the whole
difference from a layout:, which is computed once and then stands in for the model forever.
Three parts, three rules
Section titled “Three parts, three rules”An inferred tree may spread the model’s fields over sections, tabs or rows, so:
hidden | removes that field wherever it sits |
overrides | apply to that field wherever it sits |
order | reorders the fields within each container that holds them, leaving non-field siblings in their slots (the rows of one form layout — how its columns are drawn — count as one run, so a two-column form reorders as the editor shows it) |
A delta cannot move a field between containers, and cannot restructure the tree. That limit is not an omission — it is the reason a delta survives a model change at all.
The visual editor writes these
Section titled “The visual editor writes these”Drag a field in the editor and it saves a layoutDelta:, not a snapshot. Two consequences worth
knowing:
- Opening a screen and changing nothing writes
layoutDelta: {}— an empty delta, which costs the screen nothing. Using the editor must not, by itself, end a page’s inference. - Some edits cannot be a delta. Add a
Text, wrap two fields in a card, set a stereotype by hand — none of that is expressible as “these fields, in this order, with these tweaks”. The editor then falls back to writing alayout:and shows a snapshot badge instead of a delta one, so the moment a screen leaves inference is visible rather than silent.
An existing layout: page migrates by itself: open it in the editor, rearrange, and if the layout
is a flat run of the model’s own fields the next save comes back as a delta.
Hybrid: YAML layout + Java logic with @UISpec
Section titled “Hybrid: YAML layout + Java logic with @UISpec”A pure YAML file has no Java class, so it cannot run server-side logic. A pure Java ComponentTreeSupplier has no YAML file, so the layout is hard-coded.
@UISpec is the middle ground: a Java ViewModel class whose component tree is loaded from a YAML file. The Java class provides state (fields), actions (methods), rules, and validations; the YAML file defines the layout.
@UISpec("specs/ui/customer-form.yaml")public class CustomerFormViewModel {
public String name; public String email;
@Button public void save() { ... }}type: Routesroutes: - route: customer-form viewModel: com.example.CustomerFormViewModelThe YAML file at src/main/resources/specs/ui/customer-form.yaml defines the component tree rendered for this class. Mateu combines the two: layout from YAML, behaviour from Java.
See @UISpec for the full reference.
When to use YAML vs Java
Section titled “When to use YAML vs Java”| Situation | Recommendation |
|---|---|
| Static informational page (about, help, landing) | Pure YAML file |
| Page with server-side logic, computed fields, actions | @UISpec or ComponentTreeSupplier |
| Prototype or low-code scenario | Pure YAML file |
| Page that needs dependency injection or DB access | @UISpec or Java class |
| Designer-managed layout, developer-managed logic | @UISpec |
| Fully dynamic / programmatic layout | ComponentTreeSupplier |
YAML pages and Java pages can coexist freely in the same application.
See it live in the Explorer: Item overview page · Row route (the way into a record)