---
title: "Views, layout, and interaction"
description: "Inputs, layout, dialogs, popovers, header bars and images, then announcements, media, Markdown editing, native views and what a package adds, such as GPU surfaces."
modificationDate: "2026-11-30"
---

> ## Documentation index
> Fetch the complete documentation index at: https://exact.expo.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Views, layout, and interaction

<AgentInstructions>

## Submitting feedback

From the app's directory, read `bun exact.mjs feedback status`. Under `never`, keep no note.
Respect `EXACT_FEEDBACK=0` and do not change the policy.

Otherwise record specific, actionable feedback with:
`bun exact.mjs feedback note "Exact docs: https://exact.expo.dev/learn/contract-for-agents/views-layout-and-interaction: <what was wrong or missing>"`

The note goes to Expo only as that status allows. Include no secrets or personal data.

</AgentInstructions>

For an attachment of any type, use `input type="file"` with no `accept` (or
`accept="*/*"`) and `multiple` when needed. `showPicker("attach")` opens the
input with `id="attach"`; `change` receives `Picked[]` with copies under
`app:/tmp/picked/`. A copy's file name is not the file's: `path` is
`app:/tmp/picked/<id>.<ext>`, `<id>` from the launch and a counter, and `name` is the
original name. Read the bytes at `path` (grant `fs.read app:/tmp/picked`), and show or
upload them under `name`. A specific `accept` list remains bounded to image/video
types and the app's `file_handlers`. For audio, declare `audio/mpeg`, `audio/wav`,
`audio/mp4` or `audio/ogg` in `file_handlers` and name those exact types in `accept`;
`audio/*` remains outside the admitted wildcard types. XHTML uses
`application/xhtml+xml` in the same way. On Linux the agent can answer a held
picker, but the live picker is unavailable (LLP 1069.002, "Any-type input").
Android uses the system Photo Picker for `image/*`, `video/*`, or both wildcards,
when the picker is available. Specific MIME types and other lists
use the document picker; unknown extensions leave its filter unrestricted, with
`accept` checked after import. Both support `multiple` and return copies; no
photo-library or storage permission prompt is needed. Back fires `cancel`.
HEIC/HEIF stays original for an empty `accept`, `*/*`, `image/*` or an explicit
HEIC/HEIF type or extension. A specific list containing `image/jpeg`, `.jpg` or
`.jpeg` also offers HEIC/HEIF in the document picker, then converts it to upright
JPEG at quality 0.9 without location metadata. The delivered type
must still match `accept`; conversion failures fire `cancel` with a journal reason.

The view forms are element, component use, `if`/`else` (and `else if`),
keyed `for`, exhaustive option `match`, and `children`. Wrap root regions in a
stable element.
A literal `role` must name a concrete ARIA role, or it is refused.
`aria-activedescendant` names the active option while a field keeps focus
([combobox recipe](https://exact.expo.dev/recipes/combobox.md)); the web exposes it, and other hosts carry it
without using it.

Content pages can use `p`, `strong`, `em`, `blockquote`, `ul`, `ol` and `li`.
The web emits the corresponding HTML elements in the built page and when the
app updates it. A paragraph holds a string or text runs. Lists hold `li`
elements, including items from a keyed `for`. Write `li "First"` for a simple
item, or nest paragraphs and another list inside it. Use `list` for a scrolling
app list. Tables and description lists also emit their HTML elements.

Contract spells a few HTML names differently. Write `view` for a plain
`div`, or `column` and `row` for flex layout. A plain `text` becomes a
`div` on the web and a `span` inside another text. Write `h1` through `h6`
for headings, `image` for `img`, and `link` for `a`. Give a field an
`aria-label`, or use `aria-labelledby` with the ID of its visible label.
Set the document title and description with `head title=… description=…`.
A field's Enter runs its `submit` action. For a disclosure, keep `open` in
state, show the body `if open`, and toggle it from a button.
A view chooses with `if`, as an action does; a count is
`xs.length`, never `count`, `len` or `.size`; a resource's placeholder is `else
empty()` (`[]` for a list), never `else []`. A component
call uses parentheses; a built-in element uses space-separated attributes.
`button "Save" press=save` is text-child sugar; an explicit text child is useful
when that label needs its own styling or driver id. A `button` is the web's
`<button>`: a block whose content is centred in its height and whose text is
centred (`text-align: center`). Give a sized button no alignment rows; write
`display="flex"` (a row) for an icon and a label side by side, and
`text-align="start"` on a list row or card made of a button.

Use the CSS and HTML vocabulary. Defaults matter: a bare box is block and
content-box, while `row` and `column` supply flex styles. Do not emit React Native
property names, invented CSS aliases, or unknown HTML tags. Read the schema and
tag mapping for admitted properties and units. CSS standard behavior does not
imply that every browser API is implemented on every host.

For a control that should remain a Tab stop but be announced as unavailable,
write `aria-disabled=true`. It does not stop `press`; check the unavailable
state in the action. Descendant controls and inline links inherit this
accessibility state unless they explicitly say `aria-disabled=false`. HTML
`disabled=true` removes a form control from focus.
Projected Apple segments, UIKit bar items and titles, and AppKit menu items keep
that accessibility state on the native item people encounter. UIKit menu rows
and alert actions stay selectable but read as enabled; UIKit's public disabled
states would stop their input.

`class=Style` applies literal style values; node attributes win. Conditional
classes choose among named styles (or `none`) with nested ternaries such as
`class=(c1 ? A : c2 ? B : none)` (up to 16 style arms; constant conditions fold
statically). Computed values go on nodes. Styles can also carry
`backgroundMaterial`, `glassGroup` and `buttonStyle`. In a conditional class,
each prop must be set in all arms or none, unless the node supplies its own
value. `backgroundMaterial="none"`
explicitly removes a material. There is no selector cascade, dynamic style
object, or arbitrary class-string composition. A style branch can mix a number
and a CSS keyword in a property's admitted value space; this does not add
general union types.
On a number-only row such as `opacity`, a computed branch known to be a string
is refused at build time even when another branch is numeric.

`image-rendering` controls a raster image's sampling and inherits through its
ancestors. `auto` smooths; `crisp-edges` uses nearest-neighbour sampling when
shrinking or enlarging; `pixelated` enlarges to the nearest integer multiple
with nearest-neighbour sampling, then smooths to the requested size. At a
fractional scale, `pixelated` and `crisp-edges` can differ. Use
`image "assets/sprite.png" width=96 height=96 image-rendering="pixelated"`
for enlarged pixel art. The value may be bound to state or supplied by a named
style. It changes paint, not the image's natural size or layout.
Native hosts preserve the source samples when the decode fits their image
budget; a larger image uses a smaller decode so it can still be displayed.

`background-image` takes up to four linear, radial, conic or repeating linear
gradients; `mask-image` takes one. Stops take percentages, or px lengths for
linear/radial gradients (unitless zero is allowed). For example,
`background-image="repeating-linear-gradient(-45deg, transparent 0 4.243px, #e6e6e6 4.243px 5.657px)"`.
A repeating gradient’s px period stays fixed as a box resizes; mixed px/%
and omitted stops use CSS fix-up after layout. A zero period paints its last
stop, as Chrome does. `background-attachment="local"` is still
refused: separate row backgrounds restart at each row, and repetition alone
does not make a virtualized list’s background follow its content.
`contract vocab background-image` gives the grammar and limits. AppKit’s, UIKit’s,
Linux’s and the web’s hatches match Chrome
([closed issue](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/issues/closed/20261011-repeating-hatch-across-list-rows.md)). On UIKit
a repeating background with `background-attachment="fixed"` draws unfixed, as
any drawn gradient does there.

For scrolling, provide a bound and inspect measured layout. For virtualized
lists, use `list virtualized=true` (no other tag takes it), one direct keyed
`for`, and one flow root per row. A vertical list with `appearance="none"`
may also hold fixed content before and after that `for`; a second direct `for`
needs an element around it (all its rows mount). Fixed content cannot hold a
virtualized list. Fixed roots require nonnegative margin lengths, including percentages and
font-relative units, and static or relative positioning without vertical offsets
(`lower-collection-fixed-flow`).
Fixed content keeps its authored sibling layout and stays mounted even when the `for` is empty. It has no data-row key, cell styling,
`keep-mounted` entry or place in `aria-setsize`; give it an `id` for element
`scrollIntoView(id)`. Authored padding stays before the lead and after the trail.
A `for` inside a fixed element is eager and still receives
the development `long-list` notice at 200 rows.
The list's `reachstart` and `reachend` fire when its content edges (the lead's
start and the trail's end, when present) come within `reach-margin` of the port
(one port by default),
and further ahead while a fling travels toward it; page from them rather than from
`scroll` (`docs/reference.md`, "Intersection visibility"). A vertical list needs `height`, `max-height`
or a growing `flex`, which may be computed (`max-height=(narrow ? "320px" : "640px")`).
A percentage bounds it only against a definite containing-block height (a plain
`column` is content-sized), and the bake refuses (`bake-scroll-unbounded`) only a
list with no bound at all, in its first 390×844 frame, so look at the list in each
layout it takes. It takes `estimated-item-height`. A horizontal one needs a
literal `display="flex"` and a positive `height` in points, literal or computed
(`height=(cardW / 0.68)`), takes `estimated-item-width` and CSS's `gap` (or
`column-gap`) between its cards, a nonnegative number, literal or computed, and
refuses wrapping, reversed or right-to-left flow, `justify-content` other than
`flex-start`, and `reorderdrop`. A vertical list is a block, where CSS lays out
no gap: space its rows with a `margin-bottom` on the row root. An estimate may be
computed (`estimated-item-width=cardW`): when it changes, every row the list has
not mounted takes it until measured again, and the rows on screen stay where
they are; a changed gap moves every card by it.
Main-axis padding (`padding-top`/`-bottom`, a row list's `-left`/`-right`) is
CSS's room before the first row and after the last, inside the scroll content:
room under a header laid over the list, or over a tab bar
(`padding-bottom="calc(env(safe-area-inset-bottom) + 49px)"`). It takes a
number, an `env()` length or its `calc()`, or a computed number, not a
percentage; the end that `reachend`, `scrollFollowEnd` and `scroll-start="end"`
reach is past it, and on iOS the pull-to-refresh spinner draws below
`padding-top` (a padding-bottom taller than the port has limits: LLP 1010
§6.9). `scroll-padding` (`-top`/`-bottom`, a row list's `-left`/`-right`, the
same forms) is where its `scrollIntoView` aligns a row, as CSS's snapport:
with `scroll-padding-top` equal to a header's height, the first row's
`block="start"` is `scrollTop` 0. Any scroll container takes it, not only a
virtualized list.
For snapping (LLP 1008 §9), put `scroll-snap-type` on the scroller: `"x
mandatory"`, `"y mandatory"` or `"both mandatory"`, or the axis alone (`"x"`,
which is CSS's `x proximity`: it snaps only near an area). Put
`scroll-snap-align` on its areas: `"start"`, `"center"` or `"end"`, or two
values, the block axis's (y) then the inline axis's (x), as `"none center"`.
`scroll-snap-stop="always"` on an area keeps a scroll from passing over it, so a
fling moves one card or one page. `scroll-padding` insets the snapport and
`scroll-margin` grows an area. The web executes CSS. The native hosts share one
rule: the area position nearest where the platform would rest the scroll; for a
flick (a release faster than 50 points a second, or a mouse wheel's notch) at
least the next position its way from where the drag began, so a short quick
flick moves one card; short of the first `always` position past where it was
released; and for proximity only within a third of the snapport. iOS applies it
to UIKit's projected rest when a drag ends; macOS eases there when a trackpad
lifts (from where its momentum would carry the scroll) or once a mouse wheel
stops, on a scroller that has its `scroll-snap-type` when it first shows (one
that gains it later, or a reused list row that lacked it, glides as AppKit
flings it); Android aims its fling there; on Linux and Windows a whole wheel
notch moves one position at once, and finer ticks scroll freely and glide to
rest once the wheel stops. On iOS, areas whose snap
positions (alignment and `scroll-margin` applied) are each multiple of the
scrollport, every one `scroll-snap-stop="always"` with nothing insetting the
snapport, page as UIKit's `isPagingEnabled` (SwiftUI's `.paging`) does. An oversized area stays freely scrollable while it covers the snapport.
Nested scroll containers own their descendants' snap areas: `hidden` is a
boundary; `clip` is not. When a commit moves the area a mandatory scroller rests
on, the scroller follows it (iOS, macOS, Linux and Windows; on Android the
reader keeps its offset). A virtualized list also reads at most 64 unmounted row
roots near the projection (iOS, macOS; on Android around its offset when a touch
lands and around the projection at the release), from their measured or
estimated sizes, and an unmounted `always` row between the release and the rest
holds it; descendants and layout-dependent displacement need mounted rows.

To let a person pinch to zoom a photo, a diagram or a board, put it alone in a
`scroll` and write `-exact-max-zoom` (and `-exact-min-zoom` below 1 to zoom a
large child out; each defaults to 1) on the scroll: `scroll
-exact-max-zoom=4` holding one `image width="100%" height="100%"
object-fit="contain"` is a photo viewer (LLP 1057.001.000). The child keeps its
layout and is drawn scaled; the scroll's extent grows with it and centres it
while it is smaller than the port, so do not align it (`align-items`,
`justify-content`, an `auto` margin and the like are `lower-zoom-align`). The
pinch, the bounce at the limits and the double tap are the platform's;
`touch-action="manipulation"` turns the double tap off, and on a double-tap path
a `press` on content that is not a control waits for the second tap. `scrollZoom`
is the zoom as `scrollTop` is the offset: write it for Fit and 2× buttons (with
`scroll-behavior="smooth"` it animates), and read it as `e.scrollZoom` on the
`scroll` event's `ScrollEvent`; mirroring every `scroll` into the state you
bind is safe. Linux has no touch pinch or double tap, and a pinch on Windows
has no bounce: `contract vocab -exact-max-zoom` says what each host lacks.

A vertical `list virtualized=true` takes `reorderdrop`. A grouped settings list
(`appearance="auto"` or `listStyle="inset-grouped"`) also takes it when all
its rows are mounted. Each handle names the list with `reorderFor`. A settings
row moves within its own section. Its action gets the next keyed row in that
section, or `none` at the end. Both event IDs name the settings list.
Virtualized lists that share a `reorderGroup`
(each with a `reorderdrop`, an `id` and string keys) exchange rows: the drop
fires once, on the list the row lands in, with the dragged row's key, then the
key it lands before (`none` at the end) and, for an action taking one more
parameter, `ReorderEvent { from, to }`. The action decides where the row goes: a board whose cards join the bottom
of the column they are dropped on ignores that key when `from != to`. A board
has columns in a horizontal `scroll`, each with a header, a grouped list and
a quick-add. Give the list `flex=1 min-height=…` so its scroll box fills the
available height. The finger or pointer chooses the list under it, even with
a grip at the edge of a wide card. The lifted card's centre chooses the gap
within that list. Releasing over a header or gutter uses the last gap the
drag reached. To highlight that column, bind
`reordertargetchange=highlight(col)` on each grouped list. Its action takes
the bound column and a boolean. The source becomes the target on lift. When
another list takes over, the old list receives `false` and the new list
receives `true`. Drop and cancel clear the highlight. Keyboard and
accessibility moves use the same signal. Give each grip `touch-action="none"`
and no `press`, `pan`, `pointerdown` or `key` of its own, so the host's keys
(Space, the arrows, Enter, Escape) work on it. The host draws the lifted row,
holds the drop until the move shows (a second at most) and scrolls the lists
near their edges; do not build card drags by hand. Lists nest one level deep; an inner vertical list needs a literal
`height` or `max-height`. Do not revive the removed legacy `item-height`
windowing mechanism. Rows inserted, removed or resized above what the reader
sees keep the reader's place, as CSS scroll anchoring does; a list at its start
stays there, so rows inserted on top show, and one following its end
(`scrollFollowEnd`) follows it. A scroll the app asks for (`scrollIntoView`,
either form, or an ordinary scroller's `scrollTop` write) owns its scroller
until it settles: while a smooth one runs, `scrollFollowEnd` moves nothing, even
when the same action turns it on, and once it rests the end is followed only if
it rests there, as after the reader's own scroll. Its `scroll` events report the
port as it moves, the first maybe still where it was, and its `scrollend` comes
once, where it rests, after a last `scroll` whose `scrollHeight - scrollTop -
clientHeight` is under a pixel at the end. A jump-to-latest control needs
nothing more than `scrollIntoView("transcript", lastId, block="end",
behavior="smooth")` with `scrollFollowEnd=true` left on. `block="end"` aligns
the row, not the list's end: a list with `padding-bottom` (room under a composer
or a status line) takes the same `scroll-padding-bottom`, and the last row's
`block="end"` is then the end. A row root may move where it paints
(`translate`, `rotate`, `scale`, a relative `top`/`left`, `z-index`: a lifted
row being dragged) and keeps its place in the list.

A virtualized list mounts only the rows near its port, and a screen reader
moves only through mounted rows. `keep-mounted=[first(ids), ids.at(-1)]`
names rows by key that stay mounted wherever the window is: a transcript's
first and last message, so VoiceOver moves from one to the other, or a row that
is playing. It takes up to 64 keys of the `for`'s key type (LLP 1010 §6.11).

A `button` is the platform's own control by default. A background, border or
radius, rich children, or a row/attribute/context the native control cannot
support makes it your bare box instead. Classes count after merging, and a
row or incompatible child on any conditional arm keeps the whole button bare.
Grouped-list row buttons and their detail accessories stay bare by default so
UIKit can read the cell's face; explicit `appearance="auto"` carries a custom native control.
`appearance="none"` explicitly asks for your box. `appearance="auto"` explicitly
asks for the platform's button and refuses unsupported rows or children. The
switch must resolve to a literal after class merging; use `if` with two
buttons to switch. Its first `text` is the title, its second is the subtitle, and
its one `image "symbol:…"` is the symbol. Raster faces need
`appearance="none"`: the graphical plan is shared, and macOS and Linux do not
paint a native raster face yet. These are semantic face data, not layout
children. An image-only face needs a nonempty `aria-label`. With
`flex-direction="row"` (or absent), an image before/after the texts is
leading/trailing; with `flex-direction="column"` it is top/bottom.

Native buttons admit `font-size`, `font-weight`, `color`, `white-space`,
`line-clamp` and `text-align` on the button or its texts; a text's own row wins.
Apple uses only rows authored there, including classes; absent rows leave the
platform's font and colour alone. The web inherits the page's font and colour.
Tab/menu projections keep their existing ancestor `text-transform` on the
projected title, which the face query reads as painted.
`white-space="nowrap"` asks for one truncated line, `line-clamp=N` caps wrapping,
and `text-align="start"` places the face at the start of its box. The symbol
admits its own `-exact-tint-color`, `font-size`, `font-weight` and
`-exact-symbol-rendering`; a non-template icon keeps its colours under `multicolor`.
Absent symbol rows follow the title. Its `width`, `height` and `object-fit` are refused.
Apple rasterizes non-template icon SVGs into its asset catalog, so editing one
requires a native rebuild. Linux-hosted Apple builds use the installed Chromium
(`CHROME` can select it).

`gap` (or `column-gap` for a row, `row-gap` for a column) sets image-to-title
spacing. Absent means the platform's spacing, not zero; title-to-subtitle
spacing stays the platform's. `align-items` and `justify-content` accept only
`center`. `-exact-control-size` takes `mini`, `small`, `medium`, `large`;
`-exact-corner-style` takes `dynamic`, `small`, `medium`, `large`, `capsule`.
Both are style rows admitted only on native buttons, including in a class;
`-exact-control-size` written on a segmented control (a `tablist` or
`radiogroup`) sizes it as the platform's segmented control of that size
(`large` is SwiftUI's large segmented picker on iOS).
With explicit `appearance="auto"`, `border-radius` sets the authored radius
and wins over the named corner style; under the default it makes the button bare.
`padding` and its longhands set content insets. Absent leaves the native
control's insets/corners alone.
On the Mac, an image-only `plain` or `borderless` button uses AppKit's push
button height at its control size as its default minimum width and height.
Authored dimensions and padding take precedence; its focus ring follows the image.
In a window toolbar or route header, either style gives the toolbar item a borderless button.

`pointer-events` takes `none` or `auto`. A disabled native button retains
its authored colours; bind `opacity` for authored dimming. It can open a
dialog or popover with `commandfor` and `command="show-modal"`,
`"show-popover"`, `"toggle-popover"`, or with `popovertarget`; targets may be
bound, and an empty target is no target. `href`, `action` and swipe attributes
remain refused. `-exact-enabled` transitions are not available.

**Exact's menu rule** (LLP 1021): a row of a menu (`popover role="menu"`)
whose `popovertarget` (or `commandfor` with `command="show-popover"` or `"toggle-popover"`) names a
popover that is no menu opens it as if by the menu's own invoker (the button
that opened the menu, or the node its context menu opened on), as
`showPopover(id, source=)` does: not nested in the menu, so it stays open as the
menu closes on choose, beside where the menu came from. Write that popover
outside the menu: one written inside it is nested by where it is. A row naming
another menu opens its submenu, nested. The build notes each such row it can
see (literal ids, roles and actions: `lower-menu-row-popover`). Every other
row (a dialog's command, a custom one) keeps HTML's own activation. On the web
the rule takes the row as it is at the click: a press that changes a row from
naming a popover to naming something else still opens that popover, and one
changing it the other way leaves the popover nested.

On macOS, iOS and the web, an action can call `showModal(id)` or `close(id)`
for a `dialog`. macOS and the web follow the invoker's modal focus path. On
iOS a confirmation opens as an alert. Bare `close()` closes the window.

On the Mac a `dialog` that is not a confirmation is a sheet on its window, as
iOS's is a sheet (LLP 1115.002 D7.2): AppKit centres it, dims the window under
it and keeps clicks from it. It is as large as its content, at most the
window's content area, and laid out as written (an authored `width` is used,
`width="100%"` is all of that area; its insets are not, since AppKit places
it). Escape and ⌘. close it, the one `buttonStyle="filled"` button answers
Return, `closedby="none"` leaves only its own buttons, and `closedby="any"`
also takes a click on the window behind it. A popover that is not a menu is
AppKit's popover beside its invoker (D7.3), with AppKit's arrow and material,
on the side its `position-area` names (`top …` above, `right …` beside, else
below): `popover="auto"` closes on Escape, a click elsewhere or another window,
`popover="manual"` only by its own buttons. Write no surface for either: the
sheet and the popover are the platform's. A popover of a dialog's is written
inside it, as in HTML (outside it, it is inert while the dialog is open). The Mac
driver paints both in the page by default. Launch with `--chrome platform`
to show the AppKit sheet or popover. In an open dialog, `state dialog`
reports `presentation` as `sheet` or `painted`. Use `screenshot sheet.png
window` to include the sheet and the dimmed parent window. The screenshot
reply lists the windows it drew in `attached`. Both presentations support
`tap`, `type` and `tree`.

`popover` alone also accepts an optional string. For example,
`popover=(expanded ? some("manual") : none)` keeps the same mounted box:
`some("manual")` adds the property, and `none` removes it. An empty string
still declares a popover; it does not restore inline layout. After setting
`expanded = true`, call `showPopover(id)` in the same action. Setting it back
to false closes the presentation and restores the box to its inline parent.
An iframe kept in that box, with the same `src`, retains its mounted guest.
Use explicit viewport bounds and admitted positioning for an expanded
box (`position="fixed"` is also supported across hosts, LLP 1083.001). The
[resident iframe fixture](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/scripts/fixtures/iframe-resident-popover.contract)
shows the complete enter/exit action and layout.

For an invoker popover with an authored CSS area, use
`position-try-fallbacks="flip-block, flip-inline, flip-block flip-inline"`.
A fresh opening takes the first fitting attempt, retaining the base if none fits.
An open popover keeps its chosen option while it fits, including across resize;
if none fits after movement, it keeps the current one. Commas separate
attempts; spaces combine flips, applied in the order written. `flip-start`
mirrors across the top-left/bottom-right diagonal (`bottom span-right` becomes
`right span-bottom`), so `flip-start flip-block` (right, ending at the
invoker's bottom) and `flip-block flip-start` (left) differ. `none` disables
fallbacks. In a right-to-left document the diagonal runs from the top-right
corner. With no fitting option, CSS shifts the box back into the window. A
popover with an authored `position` is absolute in the top layer and is held
only at the page's start edges (the top, and the left, or the right in a
right-to-left document), so it can run past the others. The web, painted Apple
layers, Linux, Windows and the full-screen terminal implement these flips; an
authored fallback row selects painted placement on macOS for a non-menu
popover, including when added while open. Removing the row restores platform
presentation; focus and text selection survive either change. Native menus and confirmations keep platform placement. Physical areas also accept
`top span-left`, `bottom span-left`, `left`/`right` with `span-top`,
`span-bottom` or `span-all`, and the four `top|bottom left|right` corners.
Logical areas, `flip-x`, `flip-y`, named rules and area-dependent sizing are
not implemented. Use zero insets and default self-alignment for native parity.
Painted Apple, Linux, Windows and full-screen terminal invoker popovers are
sized in each option's region. An authored `position-area="none"` keeps the
viewport block; an authored `position="sticky"` keeps its ordinary layout.
Scrolling moves the selected option without changing its sizing region until
another option wins. Flips transform margins before percentages resolve there;
`flip-start` also exchanges `width`/`height`,
`min-width`/`min-height` and `max-width`/`max-height`.

A route with `navigationPresentation="modal"` is the same sheet on the Mac
(LLP 1115.002 D7.4), as large as its content (an authored `width` or `height`
is used; its `inset` is not), under the window's content area. Its `header`
is the sheet's own: the heading a title row at the top, and at the bottom
right the `id="back"` control (Cancel) and then the one prominent button
(`buttonStyle="filled"` or `"bordered-prominent"`), which answers Return.
Anything else in the header (a search field, a menu's button) stays in it, at
the top of the sheet. Escape and ⌘. go back as the `id="back"` control does;
`closedby` is a dialog's. A heading inside a pressable keeps the route painted
in the window, and `logs` says so. A `dialog`'s first-child `header` is its
sheet's rows the same way (LLP 1141.004 D6), the button that closes the dialog
(`command="close"`) as the Cancel; Escape stays the dialog's close request,
which fires `cancel`. `--chrome platform` shows the sheet: `tap
"add-save"` presses its button (`native: "NSButton"`), `back` dismisses it,
and `state navigation.sheet` names its title, its buttons and its size.

With no `buttonStyle` a button is the platform's default: plain tinted text on
iOS, a push button on macOS, bordered on the web. Say what the action is:
`buttonStyle="filled"` on the screen's main action, `"bordered"` on one that
must read as a button, nothing on a secondary or inline one; and
`destructive=true` on one that deletes, which iOS draws in the system red.
A round control that floats over content (a search or compose button in a corner, a
bookmark over a card) is `buttonStyle="glass"`, or `"prominent-glass"` filled with
the accent, with its symbol coloured by `-exact-tint-color`: iOS 26's own glass, not a
custom circle.
`buttonStyle` needs a native button; on a default button that comes out bare,
`lower-button-style` names the first reason and says to remove it or write
`appearance="none"` without `buttonStyle`. It is a styleable host-policy prop;
its names and allowable branches
are checked against `schema.json`'s `buttonStyles`. Backgrounds, borders,
shadows, filters, `font-family`, `overflow` and `direction` are refused with
`lower-button-style-attr`, naming a custom `button` as the alternative. A native button still takes size, place, opacity
and transform rows, and `-exact-layout-transition`: it takes its new size at
once and moves by its centre, so a button pinned by one edge that changes width
shows that edge off its place until the move settles. Hosts implementing the measure hook supply its fitting
size before the first frame, including height-for-width; hosts without it
keep the existing intrinsic-size report. Test the actual
platform look; macOS can report stand-ins for gap, subtitle and wrapping.
See [`controls.rs`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/contract/lower/src/controls.rs) for the checks.

**Prefer native controls.** Write the Contract form and each host draws its own
control; a hand-built lookalike (a painted switch, a row of buttons for tabs, a
drawn title bar) is a bug. [`apps/shelf`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/shelf/app.contract) is the recipe
to copy for an iPhone app: tabs, a large title with a bar button and header search, a
segmented filter, rows that push, a long-press menu, swipe to delete, the system
alert, a sheet with Cancel and Save, pull to refresh, grouped lists, persistence and
fetch, with its tests, in roles and text styles only. `bun scripts/no-tells.mjs <app>`
lists any literal colour, font size or weight an app's `.contract` files still write. On iOS:

| Write | iOS draws |
| --- | --- |
| `button` (`buttonStyle`, native by default) | `UIButton` |
| `list appearance="auto" listStyle="inset-grouped"` of `section`s (`header`, rows, `footer`) | `UICollectionView` list, as Settings ([human guide](https://exact.expo.dev/learn/contract-for-humans/input-events-and-commands.md#choosing-a-native-button)); a row of your own parts starts and ends at the cell's margin, as UIKit's own rows do, so write no padding at its ends. Android shows Material's list items, with no line between rows |
| the same, `listStyle="plain"`, each `section`'s `header` one letter (Contacts) | the list with UIKit's A–Z section index at its trailing edge, when every section has a row; sections above the letters (Favorites) stay out of it; a name that starts with no letter A–Z goes under `#`, not nowhere. Its headers pin as the list scrolls, over UIKit's blur; a `grouped` list's scroll away |
| the same, `listStyle="sidebar"`, a list of places to go (folders, sections) | UIKit's sidebar list (`.sidebar`) at every width: its ground, no separators; the web, the Mac and the painted hosts draw the plain list |
| a `section`'s `header` holding boxes of your own, not one `text`: `header` › `row gap=8 align-items="center"` › a sized `image` (or a box around one) and a `text` | UIKit's header holding your views (an avatar beside a name), laid out as you wrote them and starting at the cell's margin, so write no padding at its ends; a `padding-left` or `padding-right` you write is from the card's edge, as UIKit's header view spans the card (16 for a hand-built view pinned 16 inside it). Above and below them is UIKit's header inset, 10 points; `padding-top` and `padding-bottom` on the `header` replace it (12 for a hand-built header view's). Pinned in a plain list as a one-text header is, and one VoiceOver heading named by its texts (a header that holds a button keeps each part its own element). Several bare `text`s are refused: put them in a `row` or a `column`. A `footer` holds one `text` |
| `position="sticky" top=0` on a grouped list's section `header` | UIKit's header pinned to the list's top while its section's rows scroll under it (`pinToVisibleBounds`), as a plain list's are by default; unsaid, an inset grouped list's header scrolls away with its rows, as UIKit's does |
| `list` with no `appearance`, its rows down the page (each child is a row) | a plain list's cells: UIKit's separators, the cell's grey ground while a row is pressed, the row selected under the screen it pushed. Draw none of it, and no inset either: a row's content stands at the cell's margin (16 at each end; UIKit's, 20 in an iPhone's landscape) where you write no padding, the row `border-box` (LLP 1138); write a padding to choose your own. The row is your box; a border you write on a row is yours and replaces the separator there (`border-bottom="none"`: none), and `appearance="none"` keeps rows of your own (a transcript, a feed of cards). The Mac shows a table, the web and the Linux desktop one line between rows, Android none (LLP 1115.000 D16) |
| `delete=remove(id)` on either list's row (`disabled` beside it: no delete) | the cell's swipe action Delete, which a full swipe performs (`contract vocab swipe`) |
| `input type="checkbox" switch` | `UISwitch`; in a grouped list's row, the row and its switch are one VoiceOver element, as a Settings row is, named by the row's `aria-label`, else the switch's, else the row's text |
| `input type="radio"` (the radios of one `name` are a group) | the SF Symbols circle, filled at its centre when checked, at body size; in a grouped list's row no circle but the row's checkmark, which a tap on the row moves (LLP 1115.000 D13.2) |
| `input type="range"` (as wide as what holds it; in a `row`, `flex=1 min-width=0` beside its label) | `UISlider`. VoiceOver's swipe up or down moves it by a written `step`; with no `step`, by a twentieth of the span and at least 1; under `step="any"`, by a twentieth of the span. For a move of your own and a free drag (a seek bar: 10 s a swipe), write `step="any"` and a `key` handler that changes the value on the arrows and calls `preventDefault()`. The swipe is that keydown first, as a screen reader's step is on macOS, Android and Windows and as a keyboard's arrow is: ArrowRight raises and ArrowLeft lowers (swapped where the range's `direction` is `rtl`), and a prevented one leaves the move to the handler. In a test on iOS, `type "seek" key "ArrowRight"` (or `"ArrowLeft"`) is the swipe: the slider's own accessibility increment or decrement, whichever sends that key, with the slider's step where nothing prevents it. Its `down` and `up` halves are that step's keydown with the move, then its keyup, and `for <ms>` repeats the move as a held key does. A range with `appearance="none"` shows no `UISlider`, and the arrow at it is a keyboard's: its `key` handlers hear it and the host moves nothing. On the other hosts the same line is a keyboard's arrow, which runs the same handler; there a screen reader's step is covered by the host's own tests, and on a Mac with keyboard navigation off an arrow nothing prevents does not move the slider. On the web, VoiceOver in iOS Safari steps a range itself and sends no key |
| a box you draw with `role="slider"` or `"spinbutton"`, `aria-valuenow` (and `aria-valuemin`, `aria-valuemax`, `aria-valuetext`), `tabindex=0` and a `key` handler for the arrows | one adjustable element. VoiceOver's swipe up and down (and TalkBack's and Windows' adjust) are a keydown and keyup at it, as Safari sends them to an ARIA slider: ArrowUp and ArrowDown for a spin button or an `aria-orientation="vertical"` slider, else ArrowRight and ArrowLeft (swapped where the slider's `direction` is `rtl`). The handler changes the value, so a screen reader needs no − and + buttons |
| `aria-actions="reset"` on the spinbutton, with `button "Reset quantity" id="reset" press=reset` beside it | VoiceOver offers “Reset quantity” on the spinbutton alongside increment and decrement. Invoking it presses the button while the cursor stays on the spinbutton. A space-separated list offers multiple actions in order. Hidden, disabled and absent targets offer none. Browsers receive the attribute directly. Android exposes the actions to TalkBack. The Windows and Wayland trees carry them. Their AccessKit adapters currently leave these named actions unpublished. The terminal has no platform accessibility tree. |
| `input type="date"`, `"time"`, `"datetime-local"` | `UIDatePicker`; with an empty `value` its pill shows your `placeholder` (`placeholder="Add a date"`) or, with none, no words (LLP 1115.000 D13.1). Opening it accepts the current local date or time within `min`/`max`. On macOS, typing, an arrow or Return accepts the field's displayed value; focus alone leaves it empty. The web shows the browser's own empty field. Android shows Material's filled field, the value as the phone writes dates and `placeholder` its floating label, and Material 3's picker, in the control's `accent-color` where it has one (LLP 1115.001.000) |
| `select` of `option`s (no wider than what holds it, however long its options) | a pop-up button with its menu |
| `progress value=done max=goal` (a goal, an upload; as wide as what holds it) | `UIProgressView`, tinted by `accent-color` (LLP 1116 D8); never a drawn track and fill |
| `progress` (no `value`) | `UIActivityIndicatorView`, `.large` from a 37-point box (LLP 1069.001); on Android Material's circular indicator, turning (LLP 1115.001 D9) |
| `popover="auto" role="menu"` of `button`s, opened by `popovertarget` (a row whose `popovertarget` names another menu: its submenu; one naming any other popover opens it from the menu's own invoker, Exact's menu rule; a `role="group"` box of rows with an `aria-label`: a titled section) | `UIMenu`, nested; a section an inline `UIMenu(title:)` (LLP 1021). On Android's Material 3 dropdown menu, an explicitly written `background-color` (composited opaquely over the menu surface, with legible ink derived from its luminance) and a uniform circular `border-radius` (clamped to half the menu's shorter side) are honored on the popover container; `border`, `color`, `box-shadow`, `padding` and width stay Material's (LLP 1115.001 D10) |
| `dialog role="alertdialog" aria-label="Remove book?"` of a `text`, its action(s) and one Cancel; or a `text` and one closing button alone | `UIAlertController(.alert)`: the label its title, the text its message; the one-button alert when it has no action (LLP 1115 D6; recipe [below](https://exact.expo.dev/learn/contract-for-agents/time-motion-graphics-and-platform-facts.md#a-confirmation)) |
| a `dialog` whose own `background-color` or `background-image` you write (your panel, your colours), of any rows | HTML's top layer (LLP 1035.001 D11): presented full screen over whatever is up, a sheet included, with no transition of UIKit's, laid out as written and centred in the window, over UIKit's 20% dimming (a `::backdrop` block's `background-color` in its place, below). Its `animation` is its entrance; removed by an `if`, it stays until its `-exact-exit-animation` ends. `closedby="any"` closes it on a tap outside its box, Escape and VoiceOver's escape are its close request, and a field in it is centred above the keyboard. A box in the page with `z-index` stays under every sheet: use this |
| any other `dialog` (a field, Save, Cancel), opened by `showModal(id)` or a button's `command="show-modal"` | a sheet as tall as its content, up to the large detent, its content laid out as written and centred across it. The `dialog` has `fit-content` width, as in HTML. Put `width="100%" box-sizing="border-box"` on the `dialog` itself to fill the sheet between its side insets; a percentage width on a child alone resolves against the dialog's width. `close(id)`, its `command="close"` button or a swipe down closes it. `closedby="none"` refuses the swipe, `"any"` also takes a tap on the page behind, and a dismissal the person made fires `cancel` (LLP 1115.000 D11.5). A `header` as its first child is the sheet's bar, below |
| a `dialog` of that kind whose first child is a `header` of one heading, the text after it and buttons | a sheet in a navigation controller, as a hand-built form sheet is (LLP 1141.004 D6): the heading the bar's title (large at `aria-level=1`), the text after it the subtitle, its buttons before the heading leading and those after it trailing, a `buttonStyle="filled"` one prominent; a button that only closes the dialog (`commandfor` naming it, `command="close"`) is an item, its Cancel. A header that also holds a search field, a tablist, a readout or anything the bar has no item for stays in the dialog as written |
| `role="tablist"`: each tab a symbol over a label / one text or image | `UITabBar` / `UISegmentedControl`, the tablist at least its native height unless `min-height` says otherwise (LLP 1059) |
| `role="radiogroup"` of `button role="radio" aria-checked=…`, each one text or image (a value chosen from a few) | `UISegmentedControl`, as a tablist's; never a tab bar (LLP 1116.004 D5.2). Android draws Material's segmented buttons (two or more radios: equal shares of the row, the checked one filled with a check), and the Linux desktop and Windows the web's track with the checked radio raised on it. Keys of your own design: a radio that paints itself (its own background, border or radius, LLP 1104 D2), or `appearance="none"` on the `radiogroup`, keeps its buttons as you paint them; on the web, iOS, the Mac and the painted hosts (Linux, Windows and Android’s reader), the group keeps one Tab stop (the checked eligible radio, else the first) and arrow keys that press the next or previous eligible radio (Left and Right swapped right to left); on tvOS the focus engine moves between them |
| a route whose first child is a `header` holding one heading (`text role="heading"`; an `aria-level` alone is not one), a text after it and its buttons | the navigation bar; a level-1 heading (`aria-level=1`) is a large title, in a sheet too, and any other level an inline one; the text after it the subtitle |
| a readout of that header, outside a box around the heading (`role="status"`: words, symbols, dots and one `progress`) | an item on its side of the heading: `UIBarButtonItem(customView:)` holding the element's own views, laid out as written and live (LLP 1141.004), in the bar's type and ink where it says none, with no glass (`backgroundMaterial` its own) and in UIKit's "⋯" menu its name, dimmed. Any other element there (a spinner or a picture alone, a second text, a switch) fails the build of an app that ships iOS (`lower-header-item`), naming the repair. Android's top app bar and tvOS's bar leave a readout out, and the Mac draws the header in the page for one holding a spinner (warning `header-item-left-out` for the targets an app ships); an automatic size at most a third of the bar wide and 44 points high; desktop Linux and the web draw the header as written |
| a route whose first child is a `header` holding buttons and no heading (readouts, a search field, a tablist and plain boxes around them too, nothing else) | the navigation bar with no title, its buttons trailing and the root's `navigationBack` control leading; a text or an image in it keeps the whole header in the page (`lower-header-no-bar`) |
| a pushed route with no such `header` | a bar holding the system Back button alone (LLP 1115.000 D5.2) |
| a route with `navigationBar="none"` | no navigation bar: a full-bleed screen that draws its own way back; the edge swipe still goes back unless the route's control named by `navigationBack` is disabled; [disable that control during a run](https://exact.expo.dev/recipes/navigation-stack.md) to refuse Back |
| a route with `navigationPresentation="modal"` | a sheet |
| a route pushed while a sheet is on top, with no `navigationPresentation` of its own | pushed inside the sheet, with the system Back; the sheet's swipe down, or a tap behind a `closedby="any"` one, closes the sheet with every route pushed inside it |
| a sheet route with `navigationInspector=true` | an expanded split's inspector column beside the detail, iOS 26 (LLP 1127 §7; no decision yet); a sheet at a compact width and on other hosts |

On iOS, a system dialog sheet can use the same resting heights as a modal route.
For a form that opens tall and can be dragged down to half height, write
`navigationDetent="medium large" navigationInitialDetent="large"` on the
`dialog`. A sheet with several heights shows a grabber by default.
`navigationGrabber="visible"` or `"hidden"` chooses its visibility.
A dialog that omits `navigationDetent` fits its content.

A native `select` fits its widest option by default, as on the web
(LLP 1069.001 D3). Write `field-sizing="content"` to fit the shown value, as a
UIKit pop-up button does, on either Apple host or the web. These are intrinsic sizes; authored widths and
minimum or maximum widths still size the control's layout box.

What lies over the page beneath a modal `dialog` is the platform's dim:
UIKit's beneath a sheet or the top layer, the web's and the painted hosts'
scrim. To colour it, write CSS's `::backdrop` as a block under the `dialog`
(its value may compute) or in a `style`; it admits `background-color` alone,
with its own alpha, so `transparent` lays nothing over the page and a
full-window panel that paints its own dim is not dimmed twice. The dim fades
in as the dialog opens and out as it leaves (LLP 1035.001 D11; `contract
vocab ::backdrop`):

```contract
component App
  view
    column
      button command="show-modal" commandfor="panel"
        text "Open"
      dialog id="panel" width="100%" height="100%" background-color="#0000008C"
        ::backdrop
          background-color="transparent"
        text "Panel" background-color="#14171D" color="#FFFFFF" padding=24
```

A grouped list section's `box-shadow`, including class and state values, paints
around its card, excluding the header and footer. A section without a card
(`background-color="transparent"`) refuses a shadow. Shadow changes support
`transition`; keyframe shadow animation on a grouped section is not supported
yet and fails the build. If shadow keyframes are declared, a grouped section's
animation must name its keyframes with a literal or a choice of literals so the
compiler can check them; their timing may be computed, and an animation may
be absent. Animations that do not set `box-shadow` remain on the section. On
iPad, pointer hover over a grouped section does not activate its `:hover` shadow;
forwarding from UIKit’s visible cells, header and footer is not implemented yet.

On macOS, date, time and datetime-local controls are default Tab stops whatever
the system's Keyboard navigation setting, as `NSDatePicker` is; a select is one
only with the setting on, as `NSPopUpButton` is. `tabindex=0` makes any of them a
stop in both modes. Their native control owns focus and editing keys;
`focus`/`blur` and cancellable `key` handlers still address the Contract node.
Disabled, inert and hidden controls stay out of the loop; `tabindex=-1` allows
explicit focus while excluding sequential focus.

`contract vocab <name>` lists each one's props. A route does not scroll by
itself: its content goes in a `scroll`, `list` or `overflow-y="auto"` box, which is
the bar's scroller with nothing written (`navigationScroll` names another; "Routes
and web documents"). On Apple, `logs` journals `route-overflow` when the active
route's in-flow content, with the route's bottom padding, passes the route's padding
edge and nothing scrolls it into view. The route's own scroller does; so does the
navigation root's or the native document scroll, for content past the route's border
box, unless the route clips it or sits in a native block of its own. It checks after
first pixel once native layout settles at the window's layout size, leaving smaller
sheet and keyboard offers out. Full-window modals are checked too. A fitting layout
clears suppression so later overflow is reported again.

A sheet's swipe down and a pushed screen's edge swipe press the
route's enabled control whose `id` is the root's `navigationBack`, or, when the route
has none, one outside every route (a header the screens share).
`navigationBack` names that control's `id`, not its action: for example,
`navigationBack="close"` with `button id="close" press=back`. A literal name that
no element in the expanded view has as its `id` earns warning
`lower-navigation-back-id`. A computed name, any computed element id or an
unexpanded component prevents this check. A
matching id somewhere in the view does not prove that Back can reach it: a
control only on an inactive route is not pressed from the active one.
Naming a control is optional:
the navigation root is the app view's first element, and `navigationKey` alone there names none. The agent's
`back` presses it too, as Escape does on a Mac sheet. When a sheet's swipe down should not do what its
Cancel does (Cancel reverts the edits, a swipe down keeps them), give Cancel another `id`:
a swipe down then dismisses without pressing it, and on the Mac Cancel stays in the header,
out of the sheet's Cancel slot. A route with no such
control still has the platform's back button, edge swipe and swipe down (and the
browser's Back): they go back through the root's `navigate` handler with the location
beneath (`nav = go(nav, url)` pops to it), or, with no handler, the runner pops the
router itself, as `nav = back(nav)` would (LLP 1115 D5). On the web the browser's
Forward and a `link` to a declared route do the same with no handler: the runner goes
there itself, as `nav = go(nav, url)` would (LLP 1115.000 D4.3); a native host's link
still needs the handler. A web page reloaded on a deep route launches with the page's
earlier visits beneath it, as the runner's own `go` to each in turn leaves them, so the
browser's Back still pops, and the app bar's steps back to the entry beneath rather than
pushing one (games, on the wasm target, launch with the URL's chain alone). A declared but disabled
control refuses them, as does `closedby="none"` on a sheet. Where the app's own Back and
Forward go less far than its router (a palette open over the page, a history capped at
so many visits), bind the root's `navigationHistory` to the ways it offers now (`"back
forward"`, the default, `"back"`, `"forward"` or `"none"`): on the Mac a way withheld is
no swipe, menu item or mouse button (`contract vocab navigationHistory`). A route whose scroller opens
with a full-bleed picture says `navigationBar="transparent"`: iOS draws its bar clear at
the scroller's top and insets nothing, so the picture sits under the bar as under a fixed
transparent header on the web, and the bar's material comes as the content scrolls.
At the clear edge, the iOS bar's empty areas let touches reach the page; its title,
Back and bar items keep their touches. Once scrolled, its material's band takes touches,
as does a visible background supplied by a native hatch.
To keep foreground controls below it, use `top="var(--exact-safe-area-inset-top)"`
or that value as padding on the hero's content. This reads the route's safe area,
including its bar; `env(safe-area-inset-top)` stays 0 under `viewport-fit="auto"`.
A box in a scroller that pads by that inset under a large title follows the bar as the
title collapses, so its content moves twice as far as the finger. Give it
`-exact-safe-area-track="observed-max"` to hold the largest band the route has had in its
current bars, title mode, size class, orientation and window size; `exactGeometry` still
reads the band as it is. Until hosts report the route's configuration (LLP 1123's
activation) it reads the band as it is too.
A route that does not scroll (a game's canvas at `inset=0`, `width="100%" height="100%"`) is
likewise drawn from the screen's top edge, its bar items floating over it. On a pushed iOS
route under the platform bar, the declared Back control's text becomes the bar's back button title
beside the bar's own chevron (no text shows the chevron alone), so label it `Recipes`,
not `‹ Recipes`. With no such control the back button is UIKit's default, which since
iOS 26 is the chevron alone, the previous title unshown, as in a hand-built app; a title
there is the control's text, said.

Inside a route's `header`, wrap related bar buttons in a `row role="group"`.
iOS 26 keeps each explicit group's buttons on one shared glass background and
separates adjacent groups with UIKit's fixed-space item. Ungrouped buttons keep
the existing platform default. `buttonStyle="glass"` on a bar button gives it a
glass capsule of its own (`sharesBackground = false`), one for each button so styled. The wrappers remain ordinary layout on the web;
this adds no spacing value or custom button face.

A heading of only white space is no title on iOS, and a large title that starts empty
takes no height. To keep that height while the words load, write the heading as
`text "\u{200B}" role="heading" aria-level=1 color="transparent"`, the colour on the
heading itself (UIKit draws U+200B alone as quotation marks), and drop the colour when
the words arrive. Before iOS 26 a route pushed over it with no back control of its own
shows that title on its Back button.

The bar shows a header's heading, the first text after it (its subtitle), one search
field, one tablist and its buttons, and each other element as an item of its own, drawn
as written; of a box around the heading it shows only the title. A
menu or `dialog` written in the header is its opener's, as on the web, not bar buttons.
On iOS the search field scrolls away with the content while it is empty, as UIKit's
does; `position="sticky" top=0` on the `input` keeps it in view (React Navigation's
`hideWhenScrolling={false}`). The route's scroller runs under the bars wherever its
menus, popovers and `dialog`s are written: they take no place in its flow.
The agent paints the authored header by default, but marks such a node in `tree` and
`screenshot`, and an `expect` or `tap` on it fails, saying so. A `testId` on a bar
button, the search field, a segment or a tab is its `accessibilityIdentifier`, which
XCUITest and Maestro address.

Say what a thing is and leave how it looks unsaid: no `background-color`, `height`,
`font-size` or `padding` on these, or the host draws your box instead of its
control (LLP 1115). Worked forms, each compiled:

```text
// The navigation bar: buttons before the heading are leading items, after it
// trailing; a popovertarget button is a menu item (⋯), a search input the bar's
// search field, a tablist the segmented title.
column navigationKey=`${e.id}` navigationScroll="inbox-list" position="absolute" inset=0 display="flex" flex-direction="column"
  header
    text "Inbox" role="heading" aria-level=1
    row role="tablist"
      button role="tab" aria-selected=(filter == "all") press=show("all")
        text "All"
      button role="tab" aria-selected=(filter == "unread") press=show("unread")
        text "Unread"
    input type="search" value=query input=search placeholder="Search"
    button popovertarget="inbox-menu" aria-label="More"
      image "symbol:more"
    button press=compose aria-label="Compose"
      image "symbol:compose"
  column id="inbox-menu" popover="auto" role="menu"
    button press=compose
      text "New Message"
  // Pull to refresh: a `refresh` handler on the scroller; `refreshing` holds the
  // spinner until the reload settles. A row's `delete=` is its swipe to delete.
  // A first load is a `progress` beside the list while it has no rows, never in a
  // row: a spinner inside a cell is something a hand-built iOS list never shows.
  list id="inbox-list" refresh=reload refreshing=pending(items) flex=1 min-height=0
    for m in items key=m.id
      button press=open(m.id) delete=remove(m.id)
        text m.title

// A subtitle: the first text after the heading (UIKit's own on iOS 26).
column navigationKey=`${e.id}` navigationScroll="list" position="absolute" inset=0 display="flex" flex-direction="column"
  header
    text "Shopping List" role="heading" aria-level=1
    text `${left} ${left == 1 ? "item" : "items"} left`
    button press=add aria-label="Add Item"
      image "symbol:add"
  scroll id="list" flex=1 min-height=0
    …

// A sheet's bar: Cancel is the root's navigationBack control, which a swipe down and the
// agent's `back` press; Done trails.
column navigationKey=`${e.id}` navigationPresentation="modal" navigationScroll="form" position="absolute" inset=0 display="flex" flex-direction="column"
  header
    button id="back" press=back
      text "Cancel"
    text "New Message" role="heading"
    button press=save
      text "Done"
  scroll id="form" flex=1 min-height=0
    …
```

`action reload` is `refresh items`; `pending(items)` is true while it runs.
A segmented control in the content chooses a value or switches panels: a value
from two to five (a preset, units, a period, a filter) is a `row role="radiogroup"` of
`button role="radio" aria-checked=…`, each pressing its value (the web and painted hosts give it
arrow keys and one Tab stop); switching panels, a `row role="tablist"` of text tabs
outside the header. A list row's `delete=action` is its swipe to delete, UIKit's on
iOS (`contract vocab swipe`). Other swipe actions are a hand-written swipe row, a
`scroll` laid out as a row (`display="flex"`) whose content iOS needs exactly the
scroll's size ([pitfalls](https://exact.expo.dev/reference/pitfalls.md), "A hand-written swipe row shows its
buttons under the row"). Its swipe actions
are UIKit's, drawn by UIKit (rounded on iOS 26 and later) whatever the buttons
paint; when every control the row names says `appearance="none"`, the paint is
kept instead, in a grouped list too: the row swipes by its own scroll, as on
the web, with one row open at a time (any other swipe row's opening closes it,
and its drag closes the other's, a grouped list's row included; a touch elsewhere
in the scroll that holds it, or that scroll's drag, closes it, and the tap that
closes it presses nothing, as in a UIKit table),
a full swipe past half the row pressing the outermost action
(a haptic as it arms), and each action a VoiceOver custom action of the row's
content.

An `image` source is the same string on every host: a path under the app's
`assets/`, an `http(s)` URL, `symbol:<role>` (the roles are
[`schema.json`](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/kernel/tables/schema.json)'s `symbols`; a player's are `play`,
`pause`, their `-fill`s, `skip-back-15`, `skip-forward-15`, `skip-back-30`,
`skip-forward-30`, `speaker`, `speaker-mute` and `moon`; an unknown role is refused
with the list), `symbol:sf/<name>` (an SF Symbol by its Apple name: drawn on Apple
only, blank on the web and Linux, where `layout` reports `reason: "platform"`; a
build of an app that ships either warns, its first use with the repair and each
later one in a line; a tab or button that must show everywhere takes a role or an
icon token), an `app:/data|cache|tmp/…` file
(a picked photo, or one the data module kept with `storage.fs`; it shows after a
relaunch too), or a `data:` URL of at most 1 MiB, past which every host shows
nothing (the web and Apple journal `image refused`).

An `iframe` of a page under `assets/` or `deck/` is given an `app:/cache` or
`app:/tmp` file its `src` names in its query, encoded as any query value is:
`` src=`assets/viewer/index.html?file=${encodeURIComponent(path)}` ``. The page
reads `new URLSearchParams(location.search).get('file')` and gets a URL it can
fetch, of any size, until the frame's `src` changes. A value naming `app:/data`, a
link or a missing file is emptied (`file=`), the frame loads as usual, and the host
logs why; copy the file into `app:/cache` first. An HTML, SVG or XML file is given
as `application/octet-stream`, so it never runs as the app: read its bytes, into a
Blob of your own for an SVG `img`, or into a `srcdoc` frame under a `sandbox`
without `allow-same-origin` for HTML. The web, macOS and iOS give files; Android
does not (LLP 1020.001 D7). Shrink a picked or dropped photo for an upload limit with
`storage.fs.compressImage(path, to, {maxDimension, maxBytes})`, which writes an
upright JPEG with no location metadata (`quality`, 0 to 1, sets its quality, with
or without `maxBytes`; `type: "image/png"` writes a PNG that keeps transparency; [Exact developer reference](https://exact.expo.dev/reference/developer/generate-typescript-data-source-types.md#shrink-a-picked-image-for-upload-storagefscompressimage));
Linux answers `unsupported`. Save an edit (a turn, a flip, a crop, a size) with
`storage.fs.transformImage(path, to, {rotate, crop})`, which keeps the photo's colour,
HDR and metadata where the host can and says what it wrote
([Exact developer reference](https://exact.expo.dev/reference/developer/generate-typescript-data-source-types.md#save-an-edit-of-a-photo-storagefstransformimage));
`compressImage` takes `rotate`, `flip` and `crop` too. Upload a file with `fetch(url, {method: "POST", headers:
{"content-type": "image/jpeg"}, exactBodyFrom: path})`, not `readFile` then `body`: the host
streams the file from disk as it sends (under `fs.read`, with no size bound except 64 MiB on the
web for a file the app wrote itself), so a 2 MB photo never passes through the answer's 100 ms step
and a long video costs no memory; a missing or denied file rejects the fetch, naming why. To show an
upload's percentage while the person goes on, make it a resource's stream with `exactUploadProgress: true`:
its mapper gets `progress` (`loaded` of `total` bytes sent), then `load` with the reply's `status`, and no
answer waits for it. It is asked once for its arguments while the app runs, across a reload too, though not the
web JS target's development reload (a refresh or store write never sends it again, and one cut off after it began
comes back failed, `interrupted`), so a retry puts an attempt number in its arguments and in its URL or a header:
new arguments that make the same request keep the running upload. A launch starts afresh and sends again an upload the view still shows, so record what it answered (the
server's id for the attachment) in the store and stop showing the resource once you have it
([Exact developer reference](https://exact.expo.dev/reference/developer.md), "An upload that tells its progress"). Download a file with
`fetch(url, {exactBodyTo: path})`, not `arrayBuffer()` then `writeFile`: the host writes a 2xx body into the
file as it arrives (under `fs.write`, at most 1 GiB), so a large file never enters the engine's 64 MiB heap;
`response.exactBodyTo.bytes` is its size, and a reply that is not 2xx leaves the file untouched and reads as
usual. Keep a picked photo by copying it to
`app:/data` and answering that path; never tell hosts apart in the data module
(`HermesInternal`) to choose a source
(LLP 1069.002 D7, LLP 1011 §2).

An `image` hears HTML `<img>`'s two events, once per source, on every host: `load=` when the picture
is ready (no payload), and `error=` when it does not
load, with a `message` that says why (`error=failed` runs `action failed(message:
string)`; `error=failed("icon")` passes `"icon"` before it). Natively the
message is the reason (`HTTP 404`, `Could not connect to the server.`, `not an image
format this host decodes`), and a link it quotes has no query; the browser gives none, so the web says `the image did
not load`. On every native host a download that asking again may mend (the network, a lookup, TLS, a timeout, the spool,
a 5xx, 408 or 429, an empty body) is asked again while the picture is on screen, after 1, 2, 4, 8, 16 and 30 s
and never sooner than `Retry-After`, so its `error` comes once those are spent (about a minute of
waits, plus the downloads and any `Retry-After`), and one that fails off screen errs only after it has shown (LLP 1011 §4). A symbol fires neither. What each host's fetch of an `http(s)` source
sends, follows and accepts is LLP 1011's: macOS and iOS send no cookie and no
`Referer`, follow redirects to any host (within App Transport Security), take a
body up to 64 MiB whatever its `Content-Type` and its status, as a browser's `<img>` does
(a 404 that is an image draws; one that is not is `HTTP 404`), and keep an HTTP cache on disk;
the web is the browser's `<img>` (its cookies and `Referer` rules, no size cap). Apple
and Linux also draw SVG images, with scripts, external references and animation dropped.
The compiler checks literal `assets/…svg` and `deck/…svg` image sources with that parser:
a dropped construct warns at the source; a refused file fails a build that ships a native
target. Editing or creating a named file rebuilds the plan. Raster bytes keep their format
even under an `.svg` name.
Files unavailable at build, and remote, `app:/` or computed SVG sources, are checked at
run time. A tinted remote image on the web
needs CORS headers, or it is an `error` too. A terminal entry reads a PNG from a path
beneath its own directory, an absolute path or a `data:` URL, a regular file of at most
64 MiB; it downloads nothing and has no app directories yet, so an `http(s)` or `app:/`
source is an `error` there. A drive sees both after `clock +<ms>
real`; `clock settle` can return just before them.

## Announcing a change

There is no announce call. A screen reader reads a live region as its text changes: a
`text role="status"` (or `aria-live="polite"`) is polite, asking to wait for current
speech, and a `text role="alert"` (or `aria-live="assertive"`) asks to interrupt it.
`aria-live` wins over the role's, and `aria-live="off"` silences a `status`. To announce
a result, a form's error or "3 selected", keep such a `text` mounted, empty until there is
something to say, and change its text ([recipe](https://exact.expo.dev/recipes/announce.md)):

- Put the role on the `text` itself. Apple hosts read the text under a live box, but on
  Windows a box is read by its own accessible name, which it takes only from an
  `aria-label`, so a `row role="status"` whose child text changes says nothing there;
  Android sends the change from the box, and what TalkBack reads of it is untested.
- Leave `aria-label` off the region: on Android and Windows it is what is read, and a
  change of the text alone is not.
- Text the region already had is not read again. One that arrives holding its text is read
  on some hosts and not others (below), so mount it first.

| Host | What it does |
| --- | --- |
| iOS, iPadOS, tvOS | `UIAccessibility.post(notification: .announcement)` with the region's text, queued behind current speech when polite. An `alert` that arrives is also announced, except one already there when the app launches. A region under `aria-hidden` says nothing |
| macOS | `NSAccessibility.post(… .announcementRequested)` with the text, at low priority when polite and high when assertive; an arriving `alert` as on iOS. VoiceOver may still finish the focused control's speech first |
| Web | the browser: the element carries its `role` and any `aria-live`, and the screen reader treats it as any page's live region |
| Android | the node is a polite or assertive live region (`AccessibilityNodeInfo.setLiveRegion`), and a content change is sent from it when its accessible name changes and, usually, when it arrives; that is what TalkBack reads a live region by. TalkBack itself has not been heard reading one |
| Windows | AccessKit's UI Automation adapter: the node's `LiveSetting`, and a `LiveRegionChanged` event when its name changes, when it arrives with a name, or when a named node changes to a live priority. Not yet heard from Narrator |
| Linux on Wayland | AccessKit sends an AT-SPI `Object:Announcement` when a live name changes or arrives, with the text and its polite or assertive priority. Orca speaks it. Headless, KMS and VNC have no desktop publisher. |
| watchOS | nothing: the watch entry refuses `aria-live`, and its SwiftUI driver posts no announcement for a `status` or `alert` |

## Sound, MIDI and media

A sound effect is a declared WAV that an action plays (LLP
1096): `sound "assets/…wav"` at the
top level (16-bit or float PCM, one or two channels, at most 10 s; the compiler
reads it), then `playSound(src, at=, gain=, group=, playbackRate=, pan=)` from any
action. A path built at run time (`` `assets/kits/${kit}/kick.wav` ``) plays only the
files a `sound` line declares, so declare each one it can name. Every call is a new
voice, so a retrigger is another call. `at=` is the runner's clock
(`performanceNow()`'s milliseconds; the past means now), `gain=` a linear 0–1, and a
`group=` is monophonic by start time: a voice ends where the next one in its
group starts, as a drum machine's choke does. `playbackRate=` (0.25–4, Web Audio's
name) moves pitch and length together, as tape does: at 2 a voice is an octave up and
lasts half as long. `pan=` places it from −1 (left) to 1 (right) by Web Audio's
equal-power law (LLP 1125
D10). `stopSounds()` (or `stopSounds(group=…)`) ends what
sounds and cancels what waits. `setSounds(group=, gain=, playbackRate=, pan=, ramp=)`
changes what sounds and waits, in the group when one is given, without starting it again:
each value given moves in a straight line from where it is to the new one over `ramp=`
milliseconds (20 if left out, so a value set at every `pointermove` glides; 0 is a step),
and a voice not yet started takes it outright (LLP 1096 D14). A sound that follows a
drag starts with `playSound(…, group="drag")` on `pointerdown` and changes with
`setSounds(group="drag", …)` on each move. A rate change moves the voice's end by
what is left of its file, and a voice that had no `pan=` is panned from then on,
so give one that will pan its starting pan in `playSound` (a mono sound is 3 dB
quieter once panned, even centred). The web plays the first sound after the page's first
tap or key. Android plays through an arm loaded at the first sound, sharing Apple's
mixer. Its `audio_session` defaults to `"ambient"`: mixing, no audio focus, and
silent while the ringer is silent or vibrating. `"playback"` takes focus;
`"playback-mix"` mixes without ducking other audio. Android stops effects in the
background and when headphones are unplugged; the next foreground effects open
the output again. Linux and Windows keep the record and play nothing.

```contract
sound "assets/ding.wav"

component Ding
  action ding
    playSound("assets/ding.wav")
  view
    button "Ding" press=ding
```

To keep time (a metronome, a drum machine, an interval timer, a rhythm game), declare
what should play with a `sequence` and let the runner play it (LLP
1125 D2–D5); do not
start hits from a timer ([a step sequencer](https://exact.expo.dev/recipes/sequencer.md): lanes of their own
lengths, a kit, pause and resume, MIDI). It has a task's gate, and one `play(tracks,
bpm=…)`. A track loops at its own `beats`, `loops` times or forever (0), so tracks of
different lengths run against each other; a step is at a `beat` (a sixteenth is
`0.25`) and plays a sample, a haptic, or both. The runner issues the steps into
the voice table a second ahead on its own clock, so no action runs per step and a
busy frame does not move a beat. The arguments are read again after every commit:
change the pattern or the tempo in state and it plays from that commit, the tempo
without a jump in phase. `from=-4` with `countIn=` is a count-in; `ended=` runs an
action when a finite take ends, at that time:

```text
shape Step
  beat: number
  src: string
  gain: number
  group: string
  note: number
  velocity: number
  channel: number
  duration: number
  haptic: string

shape Track
  beats: number
  loops: number
  offset: number
  output: string
  steps: Step[]

fn click(beat: number, gain: number): Step = Step(beat=beat, src="assets/click.wav", gain=gain, group="click", note=-1, velocity=100, channel=0, duration=0.1, haptic="")

component Metronome
  state playing = false
  state bpm = 120
  resource transport = exactTransport() as shape Transport
  derive bar = [Track(beats=4, loops=0, offset=0, output="", steps=[click(0, 1), click(1, 0.5), click(2, 0.5), click(3, 0.5)])]
  sequence beat when playing
    play(bar, bpm=bpm, from=-4, countIn=[click(0, 1), click(1, 1), click(2, 1), click(3, 1)])
```

The shapes are flat and positional, as `playSounds`'s hit is: "none" is `""` or
`-1`. Keep the tracks in a `derive`, so a commit that changes nothing else
compares them at once. `exactTransport()` says what plays (`state`, `reason`,
`bpm`, `anchorAt`, `anchorBeat`); the beat now is `anchorBeat + (performanceNow() -
anchorAt) * bpm / 60000`. A playhead or beat light follows it as an animation, not a
frame task: a loop whose opacity is a computed `linear()` curve on a clock timeline,
re-read by a task keyed on the anchor ("Following the transport", below), so no app
code runs while it plays. A frame task is for text that changes
with the beat, gated on it being shown, whose action writes the beat, not the time, so a
frame that moves no beat commits nothing. The gate turning
false stops it; `stopSounds()` silences what sounds and the next steps still play.
For one or two scheduled hits, `playSounds(hits)` with `at=` is enough (a list of a
shape whose fields are, in order, `src`, `at`, `gain` and `group`, then optionally
`playbackRate` and then `pan`).

**Following the transport.** A playhead or a beat light that follows `exactTransport()`
is an animation, not a frame task: each light loops over its cycle (a bar, a lane) and
Core Animation or the browser plays it, so no app code runs while the music plays.
`level` passes a `linear()` curve's output through as the opacity, so a computed curve
says when in the cycle the light is lit; a negative delay puts the cycle where the
transport is; a clock timeline keeps a light mounted later in the same phase.

```contract
timeline Transport
keyframes level
  from opacity=0
  to opacity=1

shape Transport
  state: string
  reason: string
  bpm: number
  anchorAt: number
  anchorBeat: number

shape Step
  beat: number
  src: string
  gain: number
  group: string
  note: number
  velocity: number
  channel: number
  duration: number
  haptic: string

shape Track
  beats: number
  loops: number
  offset: number
  output: string
  steps: Step[]

fn pct(t: number, cycle: number): string = `${round(t / cycle * 10000) / 100}%`
// Lit through the first `span` ms of each `cycle`, a cycle starting `start` ms along the
// beat grid; `pos` is where the transport was when the loop mounted.
fn lit(span: number, cycle: number, start: number, pos: number): string = `level ${cycle}ms linear(1 0% ${pct(span, cycle)}, 0 ${pct(span, cycle)} 100%) ${0 - (((pos - start) % cycle) + cycle) % cycle}ms infinite`

component Beats
  state playing = false
  state pos = 0
  state synced = ""
  resource transport = exactTransport() as shape Transport
  derive anchor = `${transport.anchorAt} ${transport.anchorBeat} ${transport.bpm}`
  // `transport.bpm` is 0 before anything has played; a derive may not be Infinity.
  derive beat = 60000 / max(1, transport.bpm)
  sequence click when playing
    play([Track(beats=1, loops=0, offset=0, output="", steps=[])], bpm=120)
  // Where the transport is, read once per play, seek or tempo change.
  task follow when transport.state == "playing" key=anchor
    after(1, sync)
  action sync
    pos = transport.anchorBeat * beat + performanceNow() - transport.anchorAt
    synced = anchor
  action toggle
    playing = not playing
  view
    column padding=16 gap=8
      button press=toggle testId="toggle"
        text (playing ? "Stop" : "Play")
      row gap=8 role="img" aria-label="Beat"
        for i in range(4) key=i
          view flex=1 padding=4 border-radius=4 position="relative" background-color="-exact-tertiary-fill"
            if transport.state == "playing" and synced == anchor
              for g in [synced] key=g
                view position="absolute" inset=0 border-radius=4 background-color="AccentColor" opacity=0
                  animation=lit(beat, 4 * beat, i * beat, pos) animation-timeline=Transport
```

- **What stays a frame task:** text that changes with the beat ("Count-in 3"), gated on the
  transport states that show it. Its action writes the beat, `floor(anchorBeat +
  (performanceNow() - anchorAt) * bpm / 60000)`, never the time: the runner compares state
  after an action, so a frame on which the beat has not changed commits nothing and draws
  nothing (`apps/metronome/app.contract`'s `readout`). Read the position in an action (a
  pause's) as `anchorBeat + (performanceNow() - anchorAt) * bpm / 60000` beats.
- **A light that is not just on or off** puts every stop in the curve. Over a four-step cycle,
  a trail ember lit the step after the head and fading from 0.4 to 0.18 through it is
  `linear(0 0% 25%, 0.4 25%, 0.18 50%, 0 50% 100%)`; a fade after the beat is a few stops
  sampled from its easing.
- **A one-off change at a beat** (dim two beats after a touch) is a finite animation whose delay
  is that beat's distance from now; a second, identical `keyframes` name restarts it, as CSS
  restarts an animation only when its name changes.

Tests read the runner's record: `expect sound has "assets/ding.wav" at 0`, with any
of `gain`, `ends`, `playbackRate`, `pan` and `by end|group|cut|stop|cancelled|edit`, or
`expect sound missing …`; a sequence's steps are voices like any other, so `clock
+2000` then `expect sound has "assets/click.wav" at 1500` works with no audio, and
`expect state transport.state == "playing"` reads the transport.
`state sounds` lists the last 64 voices, `state transport` the transport.

MIDI is Web MIDI's, and the runner keeps its queue as it keeps the voices (LLP
1125 D6–D8). Grant `device.midi purpose.midi`, a line of the data module's grants
(`export const grants` in `app.ts`, `grants()` in Rust) whose second word is a key of
`strings/en.json`: `"purpose.midi": "…"`, the text the person is shown when asked. Read the ports with `resource midi = exactMIDI() as
shape MIDI` (`state`: `prompt`, `granted`, `denied`, `unavailable`; `outputs` and
`inputs`, each `{id, name, manufacturer, state}`; `sent`, the last 128 messages that
went out in time order, each `{output, data, timeStamp}`, Timing Clock left out: an activity log; a track whose `output` is `""`, and `sendMIDI("", …)`, go to no device but are listed with `output: ""`, so the log shows what plays with none connected), ask for them from a press with
`requestMIDIAccess()`, and let the person pick an output (a `select` of
`midi.outputs` by `id`). Then a step's `note` plays on its track's `output` (a
note-on, and a note-off `duration` beats later), `clockOut=output` on `play`
sends clock, Start and Stop, and `sendMIDI(output, [144, 60, 100], at=…)` sends
whole messages from an action. Hear a controller with `midimessage=heard
midiinputs=[id]` (the action may take a `MIDIMessageEvent`: `input`, `data`,
`timeStamp`, `beat`). To keep a device's time instead, `clock=input` on `play`
(a `select` of `midi.inputs`): it waits (`transport.state == "waiting"`) until the
device sends Start, then plays at the device's tempo (`transport.bpm`), and its
Stop leaves it waiting again. Nothing to schedule by hand: a host hands each message to the
device 50 ms before it is due, so an edit or a stop takes back what has not gone.
Test it with no device: `prefer midi.outputs "OP-XY"` then `tap "connect"`, and
`expect midi sent "OP-XY" 99 4c 7f at 0` (bytes in hex) or `expect midi missing …`;
`tap midi "keys" 90 3c 64` is a message from an input, `tap midi "keys" clock 125
1000` a second of its clock at 125 bpm; `state midi` lists the
queue ([Metronome](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/metronome/app.contract) is whole).

A video is HTML's `video`, not a native view (LLP 1042):
`video "assets/intro.mp4" poster="assets/intro.jpg" autoplay=true muted=true loop=true
playsinline=true object-fit="cover"` is a looping hero, which Apple draws with an
`AVPlayerLayer`. Give it a `poster` (a still of its first frame): AVPlayer takes 50 ms
to a second to draw its first frame after launch, and the poster shows until it has.
Its box is a replaced element's: with `width` and `height` auto it is the source's
natural size (300×150 until the metadata arrives), even when it is absolutely
positioned with `inset=0`, since opposing insets do not stretch a replaced element
(CSS 2.1 §10.3.8, §10.6.5), and an adaptive stream's box changes with each
rendition. To fill a box, write `width="100%" height="100%"` with `object-fit`.

On Apple, the player normally caps HLS renditions to the video's box.
`preferredMaximumResolution="640x360"` sets an author bound below that.
`startsOnFirstEligibleVariant=true` starts from the first eligible variant in
playlist order, bounded by what the box needs and the author bound; a playlist
without rendition sizes uses AVFoundation's normal selection. Playlist order
plus this flag is the start control; Exact does not reorder variants or offer
a `start-quality` attribute. See Apple's
[`startsOnFirstEligibleVariant`](https://developer.apple.com/documentation/avfoundation/avplayeritem/startsonfirsteligiblevariant).

For custom loading on Apple, mark the video `hatch="clip"` and declare that
element hatch for `ios` and `macos` in `app.json`. The app's Swift in
`modules/apple/` receives `elementConfiguration(_:_:)` synchronously before
each item is made, including source changes and `load(id)`, in list rows too.
The configuration is an `NSMutableDictionary`: `url` is the resolved source
`URL`; set `asset` to an `AVURLAsset` with your options or resource loader.
Leaving `asset` unset keeps normal loading. A cold launch waits for hatch
registration. The supplied asset goes through the same rendition bounds and
start preference. Do not load its tracks to warm it: that can select a rendition
before the item exists. At `built`, or `changed` if the player was deferred,
`element.platform` is the `AVPlayer`. Exact owns its item, playback and authored
preferences; configure loading here and add observations afterward.

For example, an app that implements a `PlaylistLoader` delegate can fetch a
multivariant playlist, put its chosen start first, make the remaining URIs
absolute, and serve it under its own scheme:

```swift
import AVFoundation

// In the app's ExactModule subclass; PlaylistLoader is the app's delegate.
private var loaders: [ObjectIdentifier: PlaylistLoader] = [:]

override func elementConfiguration(_ element: ExactElement, _ configuration: AnyObject) {
    guard element.hatch == .clip, let config = configuration as? NSMutableDictionary,
          let source = config["url"] as? URL else { return }
    let loader = PlaylistLoader(source: source)
    let asset = AVURLAsset(url: loader.url)
    asset.resourceLoader.setDelegate(loader, queue: loader.queue)
    loaders[ObjectIdentifier(element)] = loader
    config["asset"] = asset
}

override func elementEnded(_ element: ExactElement) {
    loaders.removeValue(forKey: ObjectIdentifier(element))
}
```

Keep the delegate alive while its asset is in use: the resource loader holds it
[weakly](https://developer.apple.com/documentation/avfoundation/avassetresourceloader/delegate).
A private scheme changes AirPlay and FairPlay loading behaviour; the app must
test those paths with its loader. This video hook is Apple only. Android has no
video player hook yet; the web uses its own media element.

`audio` stays HTML's player for long media
(a song, a podcast: `video`'s props and events with no picture, LLP 1042 §8).

A media source is the string an `image` takes, `app:/data` files included: an
episode the data module downloaded with `storage.fs` plays on every host but
headless Linux, which has no player. An empty `src` fails (`error`
`src-not-supported`), as HTML's does, so render the element once it has a
source. On Apple, a bundled or `app:/` HLS playlist fails with
`src-not-supported`; use a bundled MP4 or serve the HLS playlist over HTTP(S).
A bound `currentTime` seeks when its value changes; to seek to the same
time again (a skip back, "start over", a scrubber let go where it was grabbed)
call `fastSeek(id, seconds)`, which seeks each time it runs. `load(id)` loads the
source again: a retry after an `error`, or a file written since. Both name the
element by its `id`, as `focus` does.

For a URL-backed `video`, gate a custom PiP button on the bool field
`pictureInPictureEnabled` of an `exactPage()` resource. Its press calls
`requestPictureInPicture("clip")`. Bind `enterpictureinpicture` and
`leavepictureinpicture` on the video to reflect the actual presentation,
including a change from the player's own controls. A refused request fires
`pictureinpictureerror(reason)`. The browser needs transient user activation.
A task or a reply can start PiP only while that activation still holds.
`exitPictureInPicture()` closes the floating video. The image options below
apply only to images. [Host support](https://exact.expo.dev/reference/developer/run-an-app-from-a-terminal-on-macos.md#video-picture-in-picture)

Pictures that are not a video (a page a server streams as JPEG frames, a
camera's stills) float in the platform's picture-in-picture window with
`requestPictureInPicture("id")` on the `image` that shows them: the window
shows each picture its `src` names next, and the image hears
`enterpictureinpicture` and `leavepictureinpicture`;
`exitPictureInPicture()` closes the window. A request that fails is the
image's `pictureinpictureerror(message)`, on every host that cannot float it
too, so handle it where a press asked: a toast, the control unpressed. The
image may be a hidden 1-point one that a stream of its own paints; removing it
closes the window. macOS and the web's JS target float it
(LLP 1042 §9). Leave the window to the platform
unless the app must look like another: `presentation="window"` asks for a
browser's picture-in-picture window as Chromium draws it on the Mac, and
`presentation="panel"` for a floating panel with a title bar, each with
`title=`, `width=` and `height=` (LLP 1042 §9.1); the web shows either in
Document Picture-in-Picture's window where the browser has one. On macOS
each image asked for in a panel gets a panel of its own, while the
picture-in-picture window (the platform's or `"window"`) holds one image
at a time, as a browser's does, and moves to the next that asks
(LLP 1042 §9.2).

To be the system's Now Playing app (the media keys, the lock screen, Control
Center, a headset's buttons, the browser's media hub), give the player the Media
Session's `metadata=MediaMetadata(…)` and bind its actions as the element's events
(LLP 1098):

```contract
component Episode
  state paused = true
  state seek = 0
  state at = 0
  state part = 1
  action ticked(t: number)
    at = t
  action skipBy(sign: number, d: MediaSessionActionDetails)
    seek = max(0, at + sign * d.seekOffset)
  action seekAt(d: MediaSessionActionDetails)
    seek = d.seekTime
  action restart
    seek = 0
  action nextPart
    part = part + 1
  action hostPaused
    paused = true
  action hostPlaying
    paused = false
  view
    audio "assets/episode.mp3" paused=paused currentTime=seek timeupdate=ticked
      metadata=MediaMetadata(title=`Episode 12, part ${part}`, artist="The Show", album="", artwork="assets/art.png")
      seekbackwardOffset=15 seekforwardOffset=30
      seekbackward=skipBy(-1) seekforward=skipBy(1) seekto=seekAt
      previoustrack=restart nexttrack=nextPart
      pause=hostPaused playing=hostPlaying
```

- Every field is named (`album=""` when there is none); `artwork` is one image,
  an `https:` URL or an app asset path.
- The six actions are `setActionHandler`'s names: `seekbackward`, `seekforward`,
  `seekto`, `previoustrack`, `nexttrack`, `stop`. Each offers a last
  `MediaSessionActionDetails` (`action`, `seekOffset`, `seekTime`, `fastSeek`) to
  take or leave. A bound action is an offered control; the lock screen shows no
  skip button for an app that does not bind one.
- `seekbackwardOffset`/`seekforwardOffset` are what the lock screen shows and
  the `seekOffset` when the platform gives none (default 10). Keep an action that
  ignores the record (`seekforward=skip(30)`) at the offset it declares.
- Play and pause are the element's own: the platform plays and pauses the player
  and the app hears `play`, `playing` and `pause`. With `paused` bound, mirror
  them, as above.
- A Mac's previous and next keys send `previoustrack` and `nexttrack`, not the
  seeks: bind both.
- One element owns the session: the claimant that most recently started playing,
  kept while it is paused.
- On iOS the build refuses a claimant without `"audio_session": "playback"` and
  `"audio"` in `host.ios.backgroundModes` in `app.json`. `"playback-mix"` does
  not qualify: a mixable session is never Now Playing.

Tests trigger an action as the platform would and read what is published:
`tap "audio" mediasession "seekto" 600` (the seconds are a seek's `seekOffset`,
`seekto`'s time), `expect mediasession title == "Episode 12, part 1"`, `expect
mediasession has "nexttrack"`; `state mediaSession` is the whole record.

## Markdown editing and colour

A Markdown editor is a `textarea` with `markup="markdown"`; a `text` with it is
the reader (one node; the value stays the source string). Its toolbar is
`retainFocus` buttons calling `format(id, command[, argument])`, and its
`select` event hands an action the formats at the selection, for active states
([Markdown](https://exact.expo.dev/reference/contract-grammar/built-in-tags.md#markdown-markup-format-select): the commands and
the `MarkdownSelection` fields):

```contract
component Editor
  state body = "# Title"
  state bold = false
  action edit(v: string)
    body = v
  action selected(s: MarkdownSelection)
    bold = ` ${s.formats} `.includes(" bold ")
  action embolden
    format("editor", "bold")
  view
    column
      button (bold ? "Bold (on)" : "Bold") press=embolden retainFocus=true
      textarea id="editor" value=body input=edit select=selected markup="markdown"
      text body markup="markdown"
```

A document longer than a screen is one reader per block, never one reader for
the whole document ([long text](https://exact.expo.dev/recipes/long-text.md)).

Mentions, tags and citations drawn as pills in that editor and reader are
inline atoms: declare `atom` kinds by their source form, list them in `atoms=`,
give each source a face with `atomFaces=` (its label, icon and tooltip, its
colours when one chip is not coloured as its kind is, and its direction when a
chip must read left to right in right-to-left text, `direction="ltr"`, and its
accessible name when the drawn label is not what a screen reader should say,
`ariaLabel=`) and hear `atompress=`
([inline atoms](https://exact.expo.dev/reference/contract-grammar/built-in-tags.md#inline-atoms-atom-atoms-atomfaces-atompress)).
Unsaid, a pill is the platform's token; when the design draws its chips another
way, write that on the `atom` as CSS (`padding-inline`, `border`,
`border-radius`, an icon's size and the gap after it with `-exact-icon-size` and
`gap`, a ring in a `:checked` block, an underline in a `:hover` block) and leave
the rest to the platform.
Keep them out of your own rules over `setSelectionRange` and `beforeinput`: the
editor keeps a caret out of an atom and deletes it whole. An editor where
Arabic or Hebrew lines sit beside English ones gives each line its base
direction with `paragraphDirs`, HTML's `dir` words, one per source line
([Markdown](https://exact.expo.dev/reference/contract-grammar/built-in-tags.md#markdown-markup-format-select)).

Choose a colour by what it means, not by how it looks. **The accent is for
what the user can act on**: a link, a plain button's title or symbol, a filled
button's fill, a toggle's on state, the icon of a tappable row. Write it as
`AccentColor`, never as the colour the accent happens to be today
(`-exact-system-blue`): the platform keeps the accent dynamic and dims it to
grey behind an alert or a sheet to say the screen under it is inert. **A
colour of its own is for what means something by itself**: status
(`-exact-system-green`, `-exact-system-red`), text hierarchy (`-exact-label`,
`-exact-secondary-label`), data, and marks. A colour of its own never dims,
except on a native button, which greys whole as UIKit greys a button, its
symbol's `-exact-tint-color` too. On iOS the tint dims, whoever set it (the
root's `accent-color` or a node's own), as UIKit greys a view's `tintColor`:
controls, bars, text, symbols, fills, shadows, gradient stops and SVG paints in `AccentColor`.
To keep the tint from dimming on a mark that must follow an accent the app
cannot write as a value (a theme's, or one the person picks), write
`-exact-tint-adjustment="normal"` on it or an ancestor (UIKit's
`tintAdjustmentMode`). On a standard list row write it on the `row`, whose cell
UIKit draws the image in; on the image it does nothing. A bar, its items and a
tab bar keep the mode of the views UIKit holds them in, so they grey with the
screen whatever their nodes say.
Set the app's accent once, on the root:
`accent-color` on the root element is the app's accent, and on iOS it is the
window's tint, as an AccentColor asset is, so every `AccentColor`, bar, sheet
and alert follows it. On Apple hosts only, an app may instead ship its accent
as an `AccentColor` colour set in its asset catalog
(`modules/apple/*.xcassets`, below): the build names it in the app's
Info.plist (`NSAccentColorName`, as Xcode does), and it is the accent wherever
the root's `accent-color` is `auto` or absent (UIKit applies it as every
view's tint; macOS's AppKit uses it where the user's system accent is
Multicolour). The web, Linux and Windows never read it: there the root's
`accent-color` is the accent the controls take, and the web's `AccentColor`
keyword stays the browser's, so an app that wants one accent everywhere writes
it on the root. On Android a design's `AccentColor` (an `app.forma` theme) is
the controls' accent too, and it seeds Material's whole scheme in place of the
device's wallpaper palette (LLP 1115.001 D4); a root `accent-color` only tints.

Keep `id` and `testId` separate:

- `id`: host command target, geometry, cross-node references.
- `testId`: driver/test target and stable inspection name. On the web it is
  `data-testid`, not the DOM `id`: a brief that asks for element ids wants `id=`
  (and `testId=` too where tests target the node).
- `for` key: data identity for row lifetime, not either node id.

Events bind actions (`press=save`, `input=edit(item.id)`). Captured arguments come
before host payload arguments. Do not add an event object or a JavaScript closure.
`navigate` is special: no captured arguments and zero or one location parameter.
`transformgeometry` and `transformrelease` must be paired. The complete payload
matrix is in [events](https://exact.expo.dev/reference/contract-grammar/events.md).

Known host commands are statements, not expression-returning functions. Several
commands have specialized argument checks; some generic commands leave validation
to the host. Do not infer that compiler acceptance proves a command's arguments
work. Use the command's working fixture and inspect its host result.

`relaunch()` restarts the standalone macOS process after its orderly quit,
including the storage drain; it works with the development menu off. A
`beforeunload` cancellation cancels the restart. The web reloads the page.
iOS/tvOS, Linux and native agent sessions journal a refusal; for a scripted
restart, start another drive on the same `--storage`. See [host commands](https://exact.expo.dev/reference/contract-grammar/host-commands.md).

## Bar buttons, glass and the search field

- iOS 26 puts adjacent ungrouped bar buttons on one glass capsule. `buttonStyle="glass"`
  on each gives it a separate capsule of its own; a `row role="group"` keeps some on one.
- A `popovertarget` button is the item's pull-down menu. Write the menu beside the header;
  one written in it is still its button's menu, never more bar buttons.
- The header's `input type="search"` hides when scrolling while it is empty, as UIKit's
  does; `position="sticky" top=0` on it keeps the search field visible.
- The search's close button (iOS's ✕ beside an open search) empties the field, as UIKit's
  does, and the field hears `input` with `""`. It fires `cancel` at the field first, HTML's
  event for a close the person asks for: an action that calls `preventDefault()` there keeps
  the text, so the closed bar still holds it and opening the search again shows it
  (`input type="search" value=query input=search cancel=keepQuery` with `action keepQuery`
  calling `preventDefault()`).
- In an iOS split list, give the header's search input an `aria-controls` that names one
  direct body child of its route. Use a unique ID for each visit. The child holds the
  results in the same route, and its authored visibility determines when UIKit shows its
  results controller over the ordinary list; add `searchResultsPlacement="detail"` to show
  them in the detail column while the split is expanded. An auto-sized results root fills
  UIKit's viewport, so a `flex=1 min-height=0` list inside its flex column scrolls there.
  An authored result link can `open` a detail directly from the list visit. On web and
  macOS the results child stays in the authored layout. See LLP 1127.000.
- A header's buttons that press, and its disabled ones (dimmed, as UIKit's), are bar
  items; any other element is an item drawn as written ("Tabs and stacks"). Inside a box
  around the heading, what the title does not show is hidden on iOS
  (`lower-header-unplaced`).

## A horizontal strip in a sheet

`scrollIntoView(id)` scrolls every scroller above the element, as the web's does, so
scrolling a strip of choices to one moves the sheet's form too. `block="nearest"` leaves a
scroller that already shows it alone and `inline` places it across the strip:
``scrollIntoView(`icon-${i}`, block="nearest", inline="start", behavior="instant")``.

## Native views: touch input

On Android, a hosted module's `View` receives `dispatchTouchEvent` in its own
coordinates. Returning `true` for `ACTION_DOWN` accepts delivery. A drag past
touch slop on an enclosing scroller's axis cancels that delivery and scrolls the
page, as with a button inside an
[Android ViewGroup](https://developer.android.com/develop/ui/views/touch-and-input/gestures/viewgroup).
A view or descendant that needs its own pan calls
`parent.requestDisallowInterceptTouchEvent(true)` before the crossing move;
request it on down to reserve the pan, as the maps package does. Passing `false`
allows interception again. The request clears on up or cancel. An unscrollable
axis and a second pointer before interception stay with the hosted view.
A `modal` route's sheet takes an up-and-down drag the same way: the view keeps
it only if it made the request before the crossing move, so a map in a sheet
pans every way and a button there lets the sheet be dragged by it.
A control that needs one drag axis while leaving the other to enclosing
scrollers (such as a horizontal scrubber inside a vertical `scroll` under an
authored drawer `pan`) instead overrides `NativeModule.dragAxes(view)`
(`ExactExtension.dragAxes(view)` for package views) to return
`NativeModule.DRAG_HORIZONTAL` or `NativeModule.DRAG_VERTICAL` without calling
`requestDisallowInterceptTouchEvent` on down. The declared axis beats an
ancestor `pan`, same-axis scrollers and sheets once movement passes touch slop,
while exclusive Exact gestures (`swipe`, `transform`, `height`, `group`/`lift`
or a `pan` on the hosted element itself) still win.
See the [Android module seam](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/android/README.md).

## Native views: accessibility

A native view ([recipe](https://exact.expo.dev/recipes/native-views.md)) that says nothing to VoiceOver is one
element under its box's `aria-label`, with the traits of its `role`: `button`, `link`,
`img`, `switch` or `checkbox` (`aria-checked`), or `slider` (`aria-valuenow`). A view with
parts sets `accessibilityElements` (`UIAccessibilityElement`s with a label, `.button` and
`accessibilityActivate`); the box is then a group under the label.

## Native views: a package's

A package serves a tag by declaring it in its `exact.json` `views` (LLP 1133.001 D1): an
app that depends on the package places it with no `app.json` entry. Its implementation
makes it in each session, the same instance that answers its names: Swift
`view(_:id:props:events:)` on the `ExactPackage` class, a `roster` of view classes from the
web implementation, Kotlin `ExactExtension.view`; `id` is the node's. On iOS and tvOS a
Swift view that is a view controller's view returns that controller as `controller`: the
host makes it a child of the controller its node shows in (a route's) once that
controller exists, and moves it when the node shows in another (a dialog's sheet), as
for an app's `ExactNativeScreen`. The package adds it to no parent itself. A view
declared `"displayed": true` is told `displayed(id, shown, origin)` when it shows or
hides, and a prop marked `"binds": true` `bound(id, prop, origin)` when it changes. Each report carries
the origin of the commit that changed it. On Apple, a track view attaches its presentation through
`context.tracks.present`. The first matching prop and committed binding subscribe under
the less privileged of the display and binding origins. A replacement native view reads
the held reader and its waveform history when the presentation registers. A track prop
declares `"type": "handle<track>"` and `"binds": true`. For a development
`EXACT_MODULES` override, rebuild the host and its module together.
Hiding, removing or rebinding the runner node
releases its reader. A commit can hand a running track directly to another node.
Props and events must be declared;
an undeclared attribute is `lower-native-attr`. Standard box attributes and the nine
common module events remain available without a declaration. A declared prop may take
a known non-layout attribute's name where it means what CSS means by it (`exact-camera`'s
`object-fit`): written on the tag it goes to the view. A declaration that names a
layout attribute (`width`, `padding`, `flex`) is refused with `bake-view-prop-layout`,
naming the package, view and prop; give the view prop another name. A class's rows
style only the box: `object-fit` in a class never configures the viewfinder, so write
it on `exact-camera` for that. A renamed spelling (`fontSize`) is refused whatever is
declared. `packages/fixtures/swatch` is a whole one.

A view placed by a Contract library counts too, including through a re-export. The app
still declares the view's package as a direct dependency. A component the app never
instantiates does not link its views' implementations.

## A package's GPU surfaces

Pass a design colour to a GPU surface with `canvas surface=board(color("surface.board"))`.
The name must be a literal naming a colour token. Put a CSS colour or a `light-dark()` pair
in the token definition. The argument resolves at the canvas, including its inherited
`color-scheme` and Forma mode pins. A change in the resolved inputs binds them together
and requests a frame, even if only an ancestor's pin changed. In the module,
`ColorTarget::fragment` gives the shader output and `ColorTarget::clear` the
render-pass clear. The [GPU module reference](https://exact.expo.dev/reference/developer/rust-data-sources.md#gpu-device-requirements)
describes target precision and Apple system colours. An ordinary string
argument passes its text to the module.

To show a static glTF model, add `@exact/model-viewer` from
`packages/model-viewer` in this checkout. Its `modelViewer` surface supplies
the camera, picking, node styles, faded-behind rendering, clipping and
hotspot labels as Exact children. See [the model viewer recipe](https://exact.expo.dev/recipes/model-viewer.md)
for a runnable example, file sources and the surface record (LLP 1133.039).

Any package may declare `gpu` beside `views` in its main `exact.json` (LLP 1153.003 D5):

```json
"gpu": {
  "crate": "rust",
  "exactGpu": "0.4",
  "surfaces": { "sky": { "arity": 1, "factory": "sky_surface::surface" } },
  "targets": ["web", "macos", "ios", "linux"]
}
```

`crate` names a directory inside the package containing a standalone `Cargo.toml` and
`Cargo.lock`. Its dependency is `exact-gpu = "0.4"`, without a path or Git source. It uses
`exact_gpu::wgpu` and depends on no other Exact crate. Each factory returns
`Box<dyn exact_gpu::Surface>`. The build generates the registry and `module!` exports,
including the web dependencies; the package writes neither. `packages/fixtures/sky` is
a complete example.

For compute or larger resources, `gpu.limits` and `gpu.features` each take `required`
and `optional` members. Limits are objects of WebGPU camelCase names to nonnegative
integers; features are arrays of WebGPU feature names. For example,
`"limits":{"required":{"maxStorageBufferBindingSize":268435456},"optional":{"maxBufferSize":1073741824}}`
and `"features":{"optional":["float32-filterable","subgroups"]}`. The build checks names,
ranges and duplicate declarations. Each package's device requests its own requirements,
clamping optional entries to the adapter and raising paired limits as needed. An unavailable required entry refuses only that package's surfaces with a
diagnostic; apps that declare nothing keep the existing grant. `Surface::device_ready`
receives the granted `wgpu::Features` and `wgpu::Limits` before preparation, including after
recovery. See [the GPU recipe](https://exact.expo.dev/recipes/gpu-module.md) for the request and fixture APIs.

The app adds the package with `bun exact.mjs add <directory or @scope/name>` and writes
`canvas surface=sky(false)`. The package's full name supplies the module name:
`@fixture/sky` becomes `fixture-sky`. Duplicate module or surface names are refused,
including conflicts with `gpu.modules`. A placed surface may take up to `arity` positional
arguments; the surface checks named arguments and defaults.

A surface may add `"wgsl": "src"` to name the argument carrying an app shader
(LLP 1181 D9). A string literal there must name a file under `assets/`. The compiler
validates it as plain WGSL without optional WebGPU features, with one fragment
entry, built-in inputs only, one `@location(0) vec4f` output and at most one
resource: a uniform struct at group 0, binding 0. Members may be `f32`, `i32`,
`u32` or `vec2f`–`vec4f`, without aliases,
`@align` or `@size`. `time` and `devicePixelRatio` must be `f32`; `resolution` must
be `vec2f`. `src`, `maxFps`, `animationPlayState` and `alphaMode` are reserved surface
arguments, and the compiler refuses a literal value of the last three that the surface would
refuse. `alphaMode` is `"opaque"` (the default) or `"premultiplied"`, whose fragment returns
colour already multiplied by alpha.
Other named arguments bind members, with a CSS colour accepted for a `vec4f`.
The compiler checks literal values and compares the uniform reader's layout with
naga. Failures report `analyze-surface-shader` at the shader declaration or canvas,
with file, line and column. Computed sources and values are checked when they bind;
surfaces without `wgsl` keep their own validation.

`targets` names hosts among `web`, `macos`, `ios`, `tvos`, `android`, `linux` and
`windows`, and defaults to all of them; the watch draws no GPU surface. An omitted host
builds no artifact for the package, and its canvases there are drawn as they would be
without it: by the app's own `gpu/` module when that registers the name, else by the data
source on Canvas 2D. With neither, the canvas shows only its own styles, and a native host
logs that the module is absent.

Each package resolves in its own generated workspace under `.exact/package-gpu/`.
The checkout supplies `exact-gpu`. The build tries three whole dependency graphs in order:
a merge that prefers newer compatible shared versions while preserving the generated
manifest's exact pins; every package-lock entry except `exact-gpu` and competing exact
pins, plus the checkout's `exact-gpu` and the pinned dependencies; then a merge that
prefers the SDK's versions. The package-first attempt retains multiple versions in one
semver series and adds none of the SDK's other dependency blocks. Cargo resolves each
attempt; a crate Cargo picks that neither lock holds is replaced by the newest version of
the same name and series that one does, if Cargo accepts it. The first attempt whose
versions and checksums all occur in either input lock wins.
Missing Cargo sources are fetched before the locked build. If every attempt fails, the
error names each attempt's failure. An incompatible `exactGpu` requirement stops the
build before resolution. Neither input lock changes.
The app commits no Rust files for a package. Modules load only when their surfaces mount;
package WGSL is compiled into the crate, rather than shipped through `gpu.shaderRoots`.

## Model viewer

`cameraOrbit` is azimuth, polar angle from the top, then radius. Angles take
`deg` or `rad`; lengths take `m`, `cm` or `mm`. A radius of `100%` fits a
sphere around the target; `105%` leaves a margin. Unsaid, the orbit is
`"0deg 75deg 105%"`, `cameraTarget="auto auto auto"` centres the model, and
`fieldOfView="auto"` frames at 30°. A narrow canvas widens the vertical
field of view to keep the model in frame. Zoom changes radius.

Changing the orbit, target or field of view animates to that view.
`postMessage("reset", "modelViewer")` returns to those authored values after
a drag, including when a view button writes the same values again. The
record's settled camera values can be saved and bound back as a named view.
`interpolationDecay` is milliseconds, 50 by default; use 0 to jump, including
when the app honours the person's reduced-motion preference.

`cameraControls` is off unless written. On, drag to orbit, pinch or wheel to
zoom, two-finger drag or a modified/right-button drag to pan; focused, use
arrows, Shift + arrows and Page Up/Down. `disablePan` and `disableZoom` stop
those camera moves. The canvas reserves all touches and wheels in its box
at mount, even with zoom disabled. In a scrolling page, leave room beside
it to scroll. To change input mode, mount another canvas, as
[the scrolling fixture](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/packages/model-viewer/test/fixture/scrolling.contract)
does. With controls off, that fixture picks from `pointerup` by posting
`pick <offsetX> <offsetY>` to the surface.

Each `ModelNode` styles its named node and descendants. A deeper entry wins;
for the same name, the last wins. The whole entry wins, without merging
fields. `color=""` keeps material colours; otherwise use a CSS colour, with
`opacity` from 0 to 1 and `visibility="visible"` or `"hidden"`. System
colours such as `AccentColor` need platform context and are refused.
Unnamed nodes use `#<index>`; duplicate names share a style.

For the faded-behind style, mark the shell `occluder` and its inner parts
`revealed`. The inner part draws at `occludedOpacity` where the shell hides
it. Occluders are always opaque: use `occlusion="none"` when you want a
translucent shell instead. A tap picks the revealed part through an
occluder, but ordinary opaque geometry in front still blocks it. Hidden and
clipped geometry, and non-occluders at zero opacity, cannot be picked.
`message=pick` receives the deepest mesh node's name, or `""` for a miss.

`clipPosition` is a point on the plane, in model coordinates; its `auto`
axes use the model's centre. `clipNormal` points towards the half that
stays. `""` disables it. Drawing, picking and hotspot anchors share the cut;
the cut faces are not filled.

A `ModelHotspot` anchors a direct canvas child by `testId`. Its position is
in model coordinates; `position=""` uses the node subtree's bounding-box
centre. `normal=""` skips the facing test. Labels follow the camera and dim
to `minHotspotOpacity` (0.25 by default) behind opaque geometry outside
their own subtree, or when their normal faces away. They stay pressable
and accessible while dimmed; off-canvas, behind-camera, hidden-node and
clipped anchors hide them. Write a named group and label on the canvas,
and give hotspot buttons the same picking action as the model. On the web,
a label that writes `filter` overrides its occlusion fade; put that filter
on a child inside the label instead. iOS keyboard focus skips hotspots;
VoiceOver can reach them. View buttons provide a touch alternative to orbit.

`src` also accepts `app:/data/…`, `app:/cache/…` and `app:/tmp/…`. Data code
downloads or imports a GLB, writes it under its `fs.write` grant, and returns
the path to bind. Reading that path needs no surface grant. See
[the fixture's cacheModel source](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/packages/model-viewer/test/fixture/app.ts)
and its scrolling route for a file created at runtime. Direct `https:`
sources are refused. Names are ASCII, at most 128 bytes after removing
`assets/`, with no `.` or `..` path part; files are at most 64 MiB.

The reader supports `KHR_mesh_quantization` and `EXT_meshopt_compression`.
It draws static triangles with material base colours. `OPAQUE` (the default)
ignores material alpha; `MASK` keeps or drops the whole primitive at
`alphaCutoff` (0.5 by default). Both use material opacity 1; `BLEND` uses
the base colour factor's alpha. Node style `opacity` multiplies that material
opacity, except for occluders, which stay opaque. Textures, animation, skins
and morph targets are ignored. `.gltf`, sparse accessors and other required
extensions are refused. On the web, parsing blocks the page once; native
parsing runs off the frame thread.

Read `exactSurface("modelViewer")` with the imported `ModelViewerState`:

| Field | Use |
|---|---|
| `presented` | Hide the loader after the current picture is presented. |
| `src`, `loaded`, `error` | The bound source, whether it loaded, and its error sentence (`""` on success). |
| `triangles` | The displayed model's triangle count. |
| `nodes` | Names and parent names (`""` at a root), for a parts list. |
| `cameraOrbit`, `cameraTarget`, `fieldOfView` | The last settled camera, ready to save as a view. |
| `cameraView` | `front`, `right`, `back` or `left`, optionally prefixed `upper-` or `lower-`. |

A replacement keeps the old picture while loading. Failure clears it and
sets `presented=true`, `loaded=false` and `error`. The empty frame ends the
loader; show the error text that remains. The record belongs to the first
live canvas of that surface name; each canvas's picks still reach its own
handler. Import the package's shapes: records entering a GPU surface are
positional, so their declaration order matters.

The generated fixture is the tested model. Web drawing needs WebGPU. tvOS
shows the model and accepts app view buttons, but has no remote orbit or
focusable hotspots. Linux has no screen-reader bridge. Android, Windows and
physical-phone behaviour remain unqualified; watchOS and the terminal have
no GPU surface.

## Native SDK dependencies

An Apple implementation names Swift Package Manager products in its
`apple/exact.json` (LLP 1133.001 D9, expo/exact#751):

```json
{
  "swiftPackages": [{
    "url": "https://github.com/apple/swift-collections.git",
    "exactVersion": "1.1.4",
    "products": ["DequeModule"]
  }]
}
```

An implementation can ship a Swift package with `{"path":"LocalKit","products":["MapKitBridge"]}`.
Write directory names separated by `/`, relative to `exact.json`, without spaces, `.` or `..` components.
Links must stay inside the npm package. Its files count as native inputs because the Swift manifest can read them.
SwiftPM evaluates `Package.swift` during locking and building. Exact uses the same SwiftPM manifest
sandbox as a normal build. On macOS it permits file reads and restricts writes and network access.
It covers manifest evaluation only. SwiftPM supplies no equivalent manifest sandbox on Linux.
The package must declare the products. A target those products use on an Apple destination must have no
`unsafeFlags` setting for that destination. For every remote dependency,
require an exact version in `Package.swift` and list the same URL and version in this `swiftPackages` array.
For an app's own `modules/apple/*.swift`, put URL entries under `host.ios` or `host.macos` in `app.json`.
Swift imports the product's modules normally. After changing declarations, bindings or used interfaces,
run `bun exact.mjs lock`. All Apple destinations share the app's `Package.resolved` for remote packages.
Review and commit it. A build disables automatic resolution and checks every remote pin. A local-only
graph needs no Swift lock. Conflicting paths, URLs or versions for one identity name both declarations.
Lock discovery follows the compiled plan, including views placed through Contract libraries.
SwiftPM verifies binary targets by checksum. One shared dynamic library links the products used by the
app and its bound implementations. It loads with its first consumer and keeps one copy of SDK state.
A dynamic framework a package brings, such as `Sparkle.framework`, goes into
the Mac app's `Contents/Frameworks` whole, with its helpers and XPC services;
`exact release` signs each inside out with the Developer ID and the hardened
runtime ([Mac binary updates](https://exact.expo.dev/recipes/mac-binary-updates.md)).
App-local `.xcframework`s remain supported. Package resources ship with the
app and are available through `Bundle.module`. SDK privacy manifests and the
requesting implementations' declarations accompany the shared library and
dependency dylibs. CocoaPods is not supported.

Android implementations declare pinned `group:artifact:version` coordinates
in `android/exact.json`'s `maven` array; an app's own Kotlin uses
`host.android.maven`. See [Maven libraries](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/host/android/README.md#maven-libraries-one-locked-verified-gradle-graph-llp-1133008-d8-item-5)
for the shared Gradle graph, lock and verification files.

## A package's configuration

A package that needs a value from the app, such as a vendor SDK's API key or a
tile server, declares it per target in its interface's `exact.json` (LLP
1133.021 §9 item 7):

```json
"config": {
  "android": { "apiKey": { "type": "env", "required": "release", "missing": "yandex-mapkit-key-missing" } },
  "ios": { "apiKey": { "type": "env", "required": "release", "missing": "yandex-mapkit-key-missing" } },
  "web": { "tiles": { "type": "string", "required": true }, "maxZoom": "number" }
}
```

A target is `web`, `android`, `ios`, `macos` or `tvos`; each is declared on its
own, since a package binds per target. `type` is `string`, `number`, `boolean`
or `env`, and `"maxZoom": "number"` is short for `{"type": "number"}`.
`required` is `true` or `"release"`, and `missing` is the error code a build
without the key reports (else `bake-config-missing`).

The app gives the values in `app.json`, under the interface's name and the
target. A key typed `env` names the environment variable that holds its value:

```json
"packages": {
  "exact-yandex-mapkit": {
    "android": { "apiKey": { "env": "YANDEX_MAPKIT_API_KEY" } },
    "ios": { "apiKey": { "env": "YANDEX_MAPKIT_API_KEY" } }
  }
}
```

For a test key, put an override in the development section of `app.json`:

```json
"development": {
  "packages": { "exact-yandex-mapkit": { "ios": { "apiKey": { "env": "MAPKIT_TEST_KEY" } } } }
}
```

A development-trust build uses that variable for `apiKey` and keeps the
base values of other keys. A declared key may appear only in the development
section. Production reads only the base variables and values, including for
`"required": "release"`. An unset override variable leaves an optional key absent and
refuses a build that requires the key. The package reads its target's selected
values from its context. See the [package context](https://exact.expo.dev/reference/developer/package-configuration.md)
for the build's `development` fact.

An Android APK built with `--release` alone includes the Android overrides from
`development.packages`, even when signed with an upload key. Use `--bundle`
for a production App Bundle or set `EXACT_UPDATE_TRUST=production` with
`--release` for a production-trust APK.

| Target | What the package reads |
| --- | --- |
| Android | `context.config`, a `JSONObject` on `ExtensionContext` |
| iOS, macOS, tvOS | `context.config`, a `[String: Any]` on `ExactPackageContext` |
| Web | `config`, an object passed to `implementation({ config })` |

```kotlin
val key = context.config.optString("apiKey")   // "" when absent
```

```swift
let key = context.config["apiKey"] as? String
```

Every build refuses these, naming the key and never its value:

- `bake-config-type`: a value of another type than declared, such as a key
  written into `app.json` where `{"env": "…"}` is declared.
- `bake-config-unknown`: a key the interface does not declare for that target.
  The error suggests the nearest declared name.
- The declared `missing` code: a required key with no value. A key that is
  `"required": "release"` is required only in a release build. On Android, that
  is `--release` or production trust. On Apple, it is production trust
  (`--release`, or `EXACT_UPDATE_TRUST=production`) or a distributed build
  (`--distribution`, or an archive that is not `--development`). On the web,
  it is a site to host (`--out`).
  A development build without the key warns and builds.

An `app.json` entry for a package that is not installed is a warning.

An `env` reference keeps the value out of the repository. Each value selected
for this build ships inside the APK, the IPA or the page, and anyone with the app
can read it, as with a setting an app reads through `import.meta.env` (LLP
1153 D4). A value that must stay secret belongs on a server. Restrict a vendor key to the
app instead: by package name and signing certificate for Google's keys, or by
bundle id where the vendor offers it.

A native app's configuration is part of its binary. Changing a value, or the
value of a variable it names, needs a new binary, and `exact deploy` and
`exact push` classify the change that way. The binary's receipt records an
`env` value only as its SHA-256. Publishing an update therefore needs the same
variables set as the build had.

**A vendor SDK that reads its key from the Android manifest.** An `android` key
may also fill a `<meta-data>` the SDK reads by its own name:
`"metadata": "com.google.android.geo.API_KEY"`. The name must be on Exact's
list (`CONFIG_METADATA` in `scripts/android-manifest.mjs`), which today holds
only the Google Maps SDK's key. Two bound packages may not fill one name. A
package that needs another name asks for a row. An SDK that takes its key in
code, such as Yandex MapKit's `MapKitFactory.setApiKey`, needs no row.

## A package's storage and session

A package's implementation finds the session's directories behind `app:/data`,
`app:/cache` and `app:/tmp` on its context: Swift `ExactPackageContext.data`, `cache` and
`temporary`, Kotlin `ExtensionContext.data`, `cache` and `temporary`, the Linux host's
`Context::data()`, `cache()` and `temporary()`. They are the app's own, and under the
agent the drive's store, which a named store (`EXACT_AGENT_STORAGE`, `open({storage})`)
keeps across the drive's launches. The sessions of one app share them, so what a package
keeps for one session (a local replica) goes under the session's `label`, which is the
same at every launch: the name the embedder gave the session (`makeSession(label:)`; the
sample host's `a` and `b`), and in an app `main` (a later Mac window `window-2`,
`window-3`, in the order they open). `session` is unique only within the process and
`hostSession` new at each launch; key nothing durable by either.

An admitted `app:/` path that a source passes resolves on the same context: Swift
`ExactPackageContext.file` for a file and `directory` for a directory, Kotlin
`ExtensionContext.file` and `directory`. The destination may be missing, and the package
creates it; an existing destination of the other kind is refused, as is a path that
leads through a symbolic link. The result is a path, not an open handle, so a package
opens or empties it promptly (LLP 1133.009 D10).

## A package source on the web

When a package has no web implementation, a source in its `exact.json` can
still answer with `substitute.default`. An optional source can declare
`"default": null` to answer `none`. A source that lists `"web"` in
`substitute.unsupported` fails with `NotSupportedError` even if it has a default.

For a status that stays readable, use `"targets": {"web": {"available": false}}`
inside its `substitute`. The other fields keep their default values. List
`"web"` in `unsupported` on the operations that require the missing platform feature.

## A package's native module, library and web assets

A package fills the data module's one native module (`native.call` in `app.ts`) from the
`exact.json` at its root, whatever its `exports` "." names (LLP 1154 D2, D3):

```json
"native": {
  "rust": "native/lib.rs", "class": "Vault", "link": "vault",
  "library": { "aarch64-apple-darwin": { "url": "https://…/vault.xcframework.zip", "sha256": "…" } }
},
"web": { "assets": ["web/device.wasm"] }
```

`rust` is the shim's root file, relative to `exact.json`, and `class` a type in it that
implements `exact_js::NativeModule` and has `fn new(app: &str) -> Self`; the shim names only
`exact_js` and `std`. A native build joins it to the app's crate and attaches it (an app with
its own `Cargo.toml` writes `.with_native(exact_native)` in `embedded_data`). Its
`configure_storage` gets the app's roots and `sqlite(path)`, which admits `sqlite.open` under
the app's grants and answers a `SqliteFile` guard: while the module holds it, the app's own
`storage.sqlite` is refused the file, so a shim closes its own SQLite before dropping the guard,
on its close operation and in `Drop` (the host drops the module on reload).
`library` pins one `{url, sha256}` per Rust target of a dynamic library named `link`: for
Linux a shared object whose SONAME is `lib<link>.so`, for Apple a zip of one `.xcframework`
whose slice is `<link>.framework`, installed as `@rpath/<link>.framework/…`. The build
fetches it by its hash before Cargo, links it from the shim's `#[link(name = "<link>")]`, and
carries it beside a Linux executable or, signed, in an Apple bundle's `Frameworks`.
`web.assets` are served at `/assets/<package>/<path>`, captured with the package's code when
`app.ts` imports it. Each of these fails the build by name: a wrong hash; a target `library`
does not list; two dependencies declaring `native` (`bake-native-twice`).
`packages/fixtures/vault` is a whole one, its library built by `test/library.mjs`.

## What a package may ask of the Apple host

A package's native code cannot reach three things only the host owns: the app's Info.plist,
its signed entitlements, and the system's calls on the app and scene delegates. Each is a
closed list in exact2 (LLP 1133.001.000). A package opts into entries on a list and never
adds one, so installing a package never changes what the app is trusted with; a package
that needs an entry the lists lack asks exact2 for one. Nothing here reads the package's
scope: a package kept outside this repository takes its author's (`@fixture/invites`, a
whole one under `packages/fixtures/invites`), and `@exact/` names exact2's standard library.

**Info.plist keys.** A package's Apple implementation (`apple/exact.json`) adds to the
Info.plist of every app that uses it, whether or not the app grants a device. `plistKeys`
sets a key to a value, and only a key on the Apple host's allow-list, with the one value the
list gives it (`PLIST_KEYS` in `host/apple/plist.mjs`), for the platforms it names:

```json
"plistKeys": { "SKIncludeConsumableInAppPurchaseHistory": true }
```

`plist` names a dictionary keyed by the strings keys the app passes to one call's
option, each valued by its base-locale text:
`"plist": { "NSLocationTemporaryUsageDescriptionDictionary": "requestPreciseLocation.purposeKey" }`.
The build refuses, naming the package, a key not on the list, another value, a `plist`
entry that is not `"<call>.<option>"`, and any key the build itself writes. An app has
no Info.plist field of its own.

**Entitlements.** A package has no field for one. Its interface's `grants` lists the device
rows (`runner/src/device.rs`) its names need, as alternatives; a name that needs a row of its
own lists it in its own `grants`. An app that uses such a name without the line gets
`grant-missing` naming the line, and at run time the name is refused `NotAllowedError`; the app
writes the line, the build signs the row's entitlements, and `exact deploy`'s reach table shows
it. `device.shareplay`, added for such a package, signs Group Activities'
`com.apple.developer.group-session` on iOS and, under a provisioning profile that allows it,
on the Mac; not on tvOS. A Mac build without such a profile signs none and still ships.
`device.cloudkit` names no purpose and derives the container `iCloud.<bundle id>`;
`device.cloudkit iCloud.<name>` selects another container. A second container is refused.
On iOS and iPadOS, and under a provisioning profile on the Mac, it signs
`com.apple.developer.icloud-services = ["CloudKit"]`,
`com.apple.developer.icloud-container-identifiers = [<container>]` and
`com.apple.developer.icloud-container-environment`: `Development` under a development
signature, `Production` under a distribution signature, including an archive.
The profile must allow CloudKit and the selected container by value. It grants no push,
background notification mode or iCloud Documents entitlement. tvOS, App Clips and extensions
sign none. A Mac release without a suitable profile ships with CloudKit unavailable and
claims no shares. A package receiving shares declares the host event below.
`device.icloud-kv`, for an app module that uses `NSUbiquitousKeyValueStore`, names no purpose
and signs `com.apple.developer.ubiquity-kvstore-identifier` with the app's application
identifier (`<team prefix>.<bundle id>`, `SIMULATORX.<bundle id>` on a simulator) on iOS and
tvOS and, under a profile that allows it, on the Mac. Its App Clip and extensions sign none. A
device build needs a profile with the iCloud capability; a Mac release without one is refused,
since the store would keep its values on that Mac without saying so.
`device.sensitive-content-analysis`, for an app module that uses `SCSensitivityAnalyzer`, names
no purpose (the framework has no usage key; whether it analyses is the person's own setting,
`analysisPolicy`) and signs `com.apple.developer.sensitivecontentanalysis.client` as
`["analysis"]` on iOS and, under a profile that allows it, on the Mac (macOS 14 and later); not
on tvOS, and nothing on Android, Windows, Linux or the web. A device build needs a profile with
the Sensitive Content Analysis capability; a Mac release without one is refused, since the
analyzer would report nothing as sensitive.

**Host events.** A call the system makes on a delegate, held by ExactKit until the package
that takes it drains it, even when it came before the package's module loaded. The list is
`HOST_EVENTS` in `host/apple/plist.mjs`; ExactKit's `HostEvents.swift` names the same events.

| Event | Platforms | Delivered by | Needs | Writes |
| --- | --- | --- | --- | --- |
| `cloudkit-share` | iOS, macOS | iOS: the scene delegate's `windowScene(_:userDidAcceptCloudKitShareWith:)`, or the connection options' `cloudKitShareMetadata` when it launched the app; macOS: the application delegate's `application(_:userDidAcceptCloudKitShareWith:)` | `device.cloudkit`, signed in this build | `CKSharingSupported` |

The Apple implementation declares what it takes, `"hostEvents": ["cloudkit-share"]`, and its
interface `"start": "load"`, so an instance exists once the module loads. The build refuses,
naming the package, an event not on the list and one two bound packages declare. An event is
taken where a bound package declares it and the build signs its grant (on the Mac, under the
profile it chose); a taken event's key and `ExactHostEvents`, the names taken, are written to
Info.plist, and for any other neither. At launch ExactKit adds a taken event's delegate methods
by selector; an app that takes none answers none.

Each payload is the system's object, as an `NSObject` the package casts (ExactKit links neither
CloudKit nor GroupActivities), addressed to a session: in an iOS app its one session; on the Mac
the front window's; from an embedder, the session it passes to `ExactApp.hostEvent(_:_:session:)`.
One for a session that has ended goes to the first live session. At most 16 are held per event,
the oldest dropped beyond that, and one identical or equal to one still held for the session is
held once. The implementation takes what is held for its session with
`context.hostEvents.take("cloudkit-share")` and hears each later one as
`ExactHostEvents.arrived` (`userInfo` `{event, session}`, the session its `context.label`). A
test delivers one by posting `ExactHostEvents.deliver` with `{event, payload, session?}`.

## Arranged panes

`arrangement` on a box with two children, the primary and the secondary, makes them
the panes of a `UIArrangementViewController` on iOS and iPadOS 27.1 or later, and is
CSS's layout elsewhere, so write that too (LLP 1188 D3):

```text
row arrangement="split" flex=1 min-height=0
  scroll height="100%"
    …
  column height="100%"
    …
```

`"split"` puts the two side by side in a wide box, stacked in a tall one, and either side
of the hinge; `"overlay"` puts the primary over the secondary and, where the hinge divides
them, the primary at the trailing side or the bottom. `"horizontal"` or `"vertical"` after
either is the one axis it may use. A split that may not use the axis it needs, and one on an
outer display, shows the primary alone, so what a person cannot do without goes in the
primary. To keep both on an iPhone Duo's outer display, split only while the phone is open,
when the inner display has two segments side by side:
`arrangement=(viewport.horizontalViewportSegments == 2 ? "split" : "none")`, with
`viewport` read from `exactViewport()` as in [foldables](https://exact.expo.dev/recipes/foldables.md).
UIKit allocates the box's border box and stacks the panes, so padding goes on the panes,
and their flex, `order` and `z-index` as the box's items are not read there. A new value updates the same controller, animated on screen;
`"none"`, the default, is CSS.

A box that scrolls, is in a `scroll`, a `list`, a split view's column or another
arrangement, holds a stack, or has not two children (neither a dialog nor a popover) is
CSS's: the build refuses what the source proves, and `logs` names the rest. Keep tabs and
stacks around an arrangement. A list beside its detail is `navigationSplit`.

For UIKit's dimensions and placement, an element hatch can call
`element.arrange(using: controller)` with a `UIArrangementViewController` configured
with `UISplitArrangement` or `UIOverlayArrangement`, which the box keeps until the hatch
passes `nil`. Give an arranged box a definite size, such as `height="100%"` in a sized route;
allocated children do not give an auto-height parent its height.

A `true` result accepts the request; UIKit lays it out when the owning container
is available. `false` means the element is unavailable, it does not have exactly
two valid children, or a new controller is already attached or has populated
content slots. Once accepted, the request uses CSS while the element
does not have exactly two valid children, then resumes native layout when both
return. Child order and replacements follow the authored tree.

The first child is UIKit's primary pane and the second is its secondary pane.
Exact supplies their child controllers and manages the arrangement's content
slots and containment. Supply a detached controller with empty slots; reuse that
controller for configuration changes. Call UIKit's `updateArrangement(_:animated:)`
to change axes, split or overlay behavior, dimensions and placement properties.
An animated change, from a UIKit action or the hatch's `changed`, moves the panes' content with the panes.
Exact does not translate those settings. Navigation stays in the enclosing controller.
UIKit may hide a pane when the allowed axes do not suit the current display.

```swift
let arrangement = UIArrangementViewController()
arrangement.updateArrangement(.split.axes(.horizontal))
element.arrange(using: arrangement)

// A later menu action changes the same controller, keeping the authored panes.
arrangement.updateArrangement(.overlay, animated: true)
```

UIKit's `.intrinsic` dimension measures each pane's authored content under the
proposed constraints, including text wrapping and resolved pane margins.
Content and margin changes update the measure; the allocated pane size remains
UIKit's. Automatic, absolute and fractional dimensions use UIKit's sizing rules.

Each pane is laid out as a root in the space UIKit gives it: an automatic width fills
that space and an automatic height is the content's, so a pane scroller without a
height or a maximum height does not scroll. Give a pane that should fill its
allocation a height such as `height="100%"`.

UIKit lays an arrangement out under the iPhone Duo's side bar, its halves meeting at the
hinge, and each pane clears the bar itself. A route pads its content clear of the bar, so
let the arrangement span the display with `-exact-safe-area="left right"` on the route
and inset each pane's content by `var(--exact-safe-area-inset-left)` and
`var(--exact-safe-area-inset-right)`, which in a pane are the pane's own. A pane scroller's
indicator then lies at the display's edge.

Use a bounded scroller in each child for independent scrolling. The first visible
vertical scroller is the default title and scroll-to-top target; `navigationScroll`
can name another. UIKit owns bar minimization, safe-area changes, each pane's
scroll-edge effect and navigation transitions. Arrangement adoption leaves the
route's native navigation policy unchanged. The route hatch receives the enclosing
controller, so title and bar settings use UIKit directly:

```swift
let item = route.controller.navigationItem
item.largeTitleDisplayMode = .automatic
item.navigationBarMinimization.minimizationBehavior = .onScrollDown
item.navigationBarMinimization.safeAreaAdjustment = .automatic
```

Set only the native properties the app needs to change. For a fixed header, set
`minimizationBehavior` to `.never`. Select the bar's scroll view with
`route.controller.setContentScrollView(_:for:)`. An explicit native selection
survives authored layout updates. Passing `nil` makes the edge automatic again, as
in UIKit, and Exact selects as on a route the app never touched: for the top edge
the scroller `navigationScroll` names (none when it names no scroller), else the
first visible vertical one, when it sits under the bar (none when content other than
control bars sits above it), and for the bottom edge the scroller at the route's
bottom.
`contentScrollView(for:)` reports Exact's selections too, so it does not tell an
automatic edge from a selected one. UIKit takes a selection for the top and bottom
edges only: it ignores a selection for a side edge. The two edges are independent:
the setter `setContentScrollView(_:for:)` takes `.all` to select both, while the
getter `contentScrollView(for:)` takes only `.top` or `.bottom` and raises an
exception for a side edge or `.all`.
For example, a menu action can select the secondary pane after the arrangement
has mounted:

```swift
if let scroll = arrangement.viewController(for: .secondary)?.contentScrollView(for: .top) {
    route.controller.setContentScrollView(scroll, for: .top)
}
```

A pane's view controller reports its scroll view only while UIKit insets the pane, so it
reports none for a pane UIKit hides. A pane `scroll` with an element hatch always has its
scroller in the hatch's `element.scrollView`.

The route hatch's `contentScrollView` is the route's content scroll view when it is
read, the one a status-bar tap scrolls while the route is active: an app's top-edge
selection, an app-owned `UIScrollView` included; else, where the route has a
`navigationScroll`, the scroll view of the element it names, or nil when no element
carries the name or it does not scroll; else the scroll view of the route's first
vertical scroller; else the route's own viewport, which an unpresented route has
when the navigation root scrolls or native chrome uses
`interactive-widget="resizes-visual"`; else nil. A native list's scroll
view is its collection view. UIKit's
`contentScrollView(for: .top)` reports Exact's scroller only while it sits under the
bar. UIKit's bar follows a selection at once. Exact's own layout of the route follows
it (the scroller its title collapses with, the scroll views UIKit insets, and the
route's clearance) at the route's next layout or as the route appears. A selection made
during a push or a pop on screen, a presentation or a dismissal, on a route that does not
appear in it, follows when it ends, unless a batch meanwhile prepares the route's stack; a
transition that a stack off screen keeps until its tab shows again does not hold it.
Until then, after a nil, `contentScrollView(for:)` returns nil, while the route
hatch's `contentScrollView` already names Exact's automatic choice.

The containing navigation controller still owns one shared navigation bar. UIKit
decides where its large title and each pane's edge effect appear; the panes keep
their own scroll offsets and safe areas.

Declare the hatch for its platforms in `app.json`. Keep navigation outside the
arrangement and avoid nesting it in authored scrollers or other native layout
containers ([Apple's containment guidance](https://developer.apple.com/documentation/uikit/uiarrangementviewcontroller)).
Keep the same children mounted when switching between native and CSS layouts, so
folds and resizes preserve their controls, bindings and state. Older systems and
other hosts use the authored CSS layout. Duo Lab's
[Panes screen](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/duo-lab/arrangement.contract) says `arrangement` and lays its panes
out by the segments in CSS elsewhere. Duo Lab's
[Arrangement screen](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/duo-lab/arrangement-view.contract) sets title display, bar
minimization, safe-area adjustment and the bar's scroll view through the
[route hatch](https://github.com/expo/exact/blob/41ded8c5ede0b2959ef0daa83b1ff78545dd4428/apps/duo-lab/modules/apple/ArrangementOptions.swift). See Apple's
[arrangement guidance](https://developer.apple.com/design/human-interface-guidelines/designing-for-iphone-duo).
