main is the root of the whole interface. There is exactly one, in the view of the root App component (app.contract L743-L942). It holds every screen of every tab and the tab bar, and it is where iOS learns which screen is on top, how to go back, where links go, and what colour the app is.
The root line
main navigationKey=`${top(nav).id}` navigationBack="back" navigate=follow testId="app" width="100%" height="100%" accent-color="brand"
display="flex" flex-direction="column"Attribute | Meaning for the person using the app |
|---|---|
| Names the screen currently on top. When it changes, iOS animates a push, a pop or a sheet |
| The control with |
| Every link, the system Back, and deep links from outside the app arrive at one action, which goes to the location |
| The app's tint: tab selection, plain button titles and symbols in buttons. One token, |
| The shell fills the window: screens above, tab bar below |
What is inside
graph TD
M["main"] --> P["column: the panels"]
M --> T["row role=tablist"]
P --> TP["column role=tabpanel, one per tab"]
TP --> S["one screen component per stack entry"]
T --> B["4 button role=tab: Read, Activity, Agents, Me"]Panels. A column holds one column role="tabpanel" per tab. Inside each, one screen component is rendered for every entry of that tab's stack, chosen by route name (app.contract L746-L929). Covered screens stay alive, so going back restores scroll position and drafts.
Tab bar. A row role="tablist" of four button role="tab", each an image "symbol:…" over a text: book "Read", notifications "Activity", sparkles "Agents", person "Me" (app.contract L930-L942). iOS draws it as the system tab bar. The app sets no height, colour or background on it.
What each screen adds
Every screen component's own root is a column that reports to the shell:
Attribute on the screen's root | Uses | Effect |
|---|---|---|
| 24 | Identifies this screen in the stack |
| 22 | Names the screen's scroller, so the bar's large title collapses with it |
| 10 | Presents the screen as a sheet |
| 2 | Thread and Agent session: the screen shrinks when the keyboard opens, so the composer stays above it |
The ten sheets: Open site, Directory, Compose comment, New agent, Providers, Agent server, Create identity, Import identity, Edit profile and Connect vault. The other 13 screens are tab roots or pushes (Every screen).
What the platform contributes
With only those attributes written, iOS supplies: the tab bar and its selection state, a separate stack per tab that survives switching tabs, push and pop animations, the Back chevron and edge swipe, sheet presentation with rounded corners and swipe to dismiss, the navigation bar (bars), safe areas, and the tint everywhere. On a wide web window the same tab list becomes a sidebar; that is outside this documentation's scope.
Used by
main is written once and contains everything. All 23 screen components are rendered inside it, plus one inline test fixture route (agents-test) that is not product UI.
Where it is written |
|
|---|---|
the root | 1 |
Total | 1 |
Rules for use
A new screen is a new route rendered in the route switch, never a block swapped in by a condition. That is what gives it a Back button, a URL and its own scroll position.
A form over a screen is a route with navigationPresentation="modal", with its dismiss control marked id="back" (Stacks, pushes and sheets).
Do not set the tint anywhere else. Screens use brand for painted content only.
Do not style the tab bar or add a fifth tab without a product reason: four top-level jobs are the app's structure (The four tabs).
Do not hide the tab bar per screen. In the built app it stays visible on every pushed screen and is covered only by sheets.
Why
DESIGN.md: "Four tabs, each with its own stack ... Sheets are routes with navigationPresentation=\"modal\"", replacing the React Native app's single stack (What changed from the React Native app and why). Declaring structure and letting iOS draw it is the first principle in its purest form (Leave it unsaid).
User stories
This page helps deliver these stories. Each story lists this page in its Trace, so the link holds in both directions (traceability).
US-READ-01 Open the app to my site's home: The app shell that holds the tab panels and the tab bar
US-APP-01 The app feels like an iPhone app: The root element that becomes stacks, sheets and the tab bar
US-APP-02 Move around the app without losing my place: The root element that keeps every tab's stack alive
Do you like what you are reading? Subscribe to receive updates.
Unsubscribe anytime