This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index at /llms.txt, or add .md to any page's URL.

Your first component

This is a complete file. Save it as app.contract and compile it with the command above. To run it, put it in a scaffolded app in place of its app.contract, delete the scaffold's greeting entry from sources in app.ts, and replace app.test.contract with the test under Testing.
contract
component Counter
state count = 0
action increment
count = count + 1
action reset
count = 0
view
column gap=12
text `Count: ${count}` role="heading" aria-level=1 testId="count"
row gap=8
button press=increment testId="increment"
text "Add one"
button press=reset testId="reset"
text "Reset"
The first component is the app's root. state holds a value, and an action changes it. view describes the visible tree. Indentation makes the two buttons children of the row. press=increment binds an action; it does not call that action while building the view. A template puts the current count into text.
testId gives the driver a stable name for a node. It is separate from id, which host commands and geometry functions use.
Is this helpful
Last updated November 30, 2026
Exact Docs