Contract views and built-in calls
The view elements, attributes, navigation attributes and built-in calls Seed Exact uses in its contracts, each with a real example.

This page continues The Contract language with the part of Contract that draws screens: the elements inside a view, the attributes that make a column a screen or a sheet, and the built-in calls an action can make. Every example is from the app.

View elements and attributes

Kind

Real example

Source

Loops and branches

for t in nav.tabs key=t.name, if e.name == "read"

app.contract L747-L753

Calling a component

DocScreen(eid=…, docs=docs, loading=pending(docs), retry=readRetry, …)

app.contract L751

Navigation root

main navigationKey=… navigationBack="back" navigate=follow accent-color="brand"

app.contract L744

A screen

column navigationKey=eid navigationScroll=… holding a header with text title role="heading" aria-level=1 and buttons

read.contract L294-L311

A sheet

navigationPresentation="modal" on the route's column

agents.contract L654-L656

Native list with pull to refresh

list … appearance="none" refresh=refresh refreshing=(loading and loaded)

read.contract L312

Markdown text

text b.md markup="markdown" font="type.reading"

read.contract L192

Links

link href=c.href …, link href=path("server")

discuss.contract L77, me.contract L104

Fields

textarea id="reply-composer" value=draft input=edit, input type="url" … submit=connect, select value=providerType

discuss.contract L182, me.contract L369, agents.contract L776

Confirmation

dialog id="me-remove" role="alertdialog" with command="close" buttons

me.contract L125-L129

Tab bar

row role="tablist" of button role="tab" aria-controls=… aria-selected=… press=pick("read")

app.contract L930-L942

Symbols

image "symbol:list"

read.contract L303

Built-in calls

Call

Use in the app

Source

push, back, go, select, path, top, stack

all navigation, see Navigation and routes

app.contract L275-L280

share(title=…, url=…)

share a document, share an exported key

read.contract L291-L292, app.contract L644

haptic("success"), haptic("selection")

after a posted comment, on switching identity

app.contract L355, L604

focus(id)

focus the reply composer

app.contract L337-L339

openURL(url)

open the vault connect page in the browser

app.contract L701

copyText(text)

copy the recovery phrase

app.contract L561-L562

showModal(id)

open a confirmation dialog

app.contract L605-L610

scrollIntoView(…)

keep the chat at its newest row

app.contract L538

performanceNow()

milliseconds since launch, added to time.epochAtZero for a wall clock

app.contract L306-L307

formatDate, formatDay

relative and absolute dates

read.contract L93, activity.contract L96

searchParam, encodeURIComponent, first, sum

route queries, link building, list helpers

app.contract L96, L20

Rules worth remembering

    Every for needs a key. The root keys tabs by name and stack entries by e.id.

    A screen is a route, not an if over state. The root view loops over nav.tabs and each tab's stack and renders one screen component per entry, see Navigation and routes.

    Covered screens stay mounted, so each screen is told whether it is active and only then carries the plain testIds tests use (read.contract L4-L7), see Contract UI tests.

    Leave platform controls unpainted. Colours are platform roles or Tamber tokens, see Shared components and visual design.

    Built-in calls are effects, so they are allowed only inside actions.

Do you like what you are reading? Subscribe to receive updates.

Unsubscribe anytime