Skip to content

Page runtime and state API

This guide describes Page lifecycle and the IPageState integration API. For the visual authoring procedure, use Create Pages; for shared ownership and route concepts, use the interface guide.

Pages are created from a Flow and retain that Flow’s boardId. Open them from Explorer → UI in their owning Flow.

These are separate records:

RecordOwns
PageComponents, widget references, canvas settings, layout, lifecycle hooks, and metadata
EventThe board and node to run, execution mode, event interface, and optional default_page_id
RouteOnly a URL path and the eventId that handles it

A navigable Page is resolved in two steps:

  1. The route maps a pathname to an app event.
  2. The event’s default_page_id selects the Page.

The Page does not need a separate route object pointing directly to it. See Routes for the current mapping API.

Flow snapshots include the Pages listed by that Flow. For a pinned Event, runtime Page resolution loads the Page from the Event’s board_version. An unpinned Event loads the latest Page. The Page Builder loads the latest Page independently of Studio’s selected graph version; see snapshot boundaries.

Follow Create Pages to add a Page from its Flow. Studio opens it in an editor tab. The standalone Page Builder URL remains available for links and integrations; it is described below.

The Page Builder hosts the shared WidgetBuilder component and adds Page-specific behavior around it:

  • a Page switcher when the app has multiple Pages;
  • an Open Flow button when the Page has a board;
  • automatic saving and a visible saving/unsaved/saved state;
  • Page settings for behavior, layout, and SEO;
  • the global FlowPilot assistant with the active surface as context.

The builder URL accepts:

/page-builder?id=<pageId>&app=<appId>&board=<boardId>

board is optional in the URL, but a Page created from a Flow stores its board association and uses it to discover available Simple Event nodes.

The public state interface stores the following core fields:

interface IPage {
id: string;
name: string;
route?: string;
content: PageContent[];
layoutType: "Freeform" | "Stack" | "Grid" | "Sidebar" | "HolyGrail";
components: SurfaceComponent[];
boardId?: string;
canvasSettings?: {
backgroundColor?: string;
backgroundImage?: string;
padding?: string;
customCss?: string;
};
onLoadEventId?: string;
onUnloadEventId?: string;
onIntervalEventId?: string;
onIntervalSeconds?: number;
noCache?: boolean;
title?: string;
meta?: PageMeta;
widgetRefs?: Record<string, IWidgetRef>;
version?: [number, number, number];
createdAt: string;
updatedAt: string;
}

components is the editable A2UI surface. widgetRefs stores the Widget definitions needed by Widget instances on that Page.

Edit the Page name and description, inspect the immutable Page ID and current version, and save metadata explicitly.

A Page can invoke Simple Event nodes from its connected Flow:

HookWhen it runs
On Page LoadAfter the Page is loaded
On Page UnloadWhen the user navigates away
On IntervalRepeatedly at a positive interval in seconds

A Page with an On Load event renders its layout immediately, together with the last output its load event rendered for the same user, route and query. The load event then refreshes that output in place, and a thin progress bar shows until it renders. Turn on No cache to show only fresh output: the Page then displays a loading screen until the load event renders.

The settings panel only lists events_simple nodes from the connected board. If the list is empty, add a Simple Event node to that Flow.

The current layout choices are:

TypeIntended use
FreeformPosition elements freely
StackBuild a vertical composition
GridArrange content on a grid
SidebarCombine main content and a sidebar
HolyGrailUse the classic header, columns, and footer pattern

Canvas settings control the background color or image, outer padding, and custom CSS. Component-level responsive styling remains part of the A2UI component graph.

Set the Page title, meta description, favicon, and theme color. These values describe the Page; they do not configure its app route.

interface IPageState {
getPages(appId: string, boardId?: string): Promise<PageListItem[]>;
getPage(appId: string, pageId: string, boardId?: string): Promise<IPage>;
createPage(
appId: string,
pageId: string,
name: string,
route: string,
boardId: string,
title?: string,
): Promise<IPage>;
updatePage(appId: string, page: IPage): Promise<void>;
deletePage(appId: string, pageId: string, boardId: string): Promise<void>;
}

Although createPage takes a route argument, exposing a Page to users requires an Event and a path → eventId route mapping.

Component and Widget-reference changes are saved after a short debounce. Page metadata and canvas settings use their own shorter debounce, and the settings panel also offers an explicit metadata save.

Use Preview to test the surface at Desktop, Laptop, Tablet, Mobile, or Mobile Small dimensions. Test lifecycle events against representative data before publishing the app.

  • Visual Builder: learn every part of the shared editor
  • Widgets: create reusable blocks for Pages
  • Routes: expose a Page through an Event