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.
Language inventory
Form | Placement | Meaning |
|---|---|---|
use A, B as C from "./file.contract" | File | Names from another file; nothing unnamed comes along (LLP 1091); contract fmt --uses app.contract writes the lines contract-use-missing names |
use Card from "@acme/ui" / use Activity from "exact:motion" | File | A package's names (from node_modules), or a built-in's: exact:motion, exact:content (content components) |
shape Name | File | Finite record with typed fields |
fn name(arg: T): U = expr | File | Effect-free, nonrecursive expression function |
style Name | File | Literal style attributes |
keyframes Name | File | Constant animation frames |
font "Family" = "path.ttf" | File | Bundled family; block form supports faces |
routes nav | Root file | Route table and implicit router state |
component Name | File | Root (first component) or reusable child |
test "description" | Test file, normally | Agent interaction steps; not a plan assertion block |
props / inject | Component | Typed interface / inherited bindings |
provide | Component | Whole-view provider bindings, one per line |
slot | Component | Accept caller-authored children |
state name = expr / state name: T = expr | Component | Stored state; its type is inferred unless declared |
derive name = expr | Component | Dependency-driven computed value |
resource name = source(args) as shape T | Root or bounded child | Reactive data request |
mutation name as shape T [queue | parallel] | Root or bounded child | Optional reply slot for explicit sends |
action name(args) | Component | Event transaction; effects inferred |
task name mount / task name when cond [key=expr] | Root or bounded child | One timer/frame schedule or keyed change action, always or while cond holds |
view | Component | UI tree |
Top-level declarations begin in column 1. Indent with spaces. Comments use //.
Use double quotes for strings and backticks for templates. Names admit CSS
hyphens, so write a - b for subtraction between identifiers. Units are quoted
("12px", "50%"), not number suffixes. Element attribute continuation lines
are deeper than the element and begin with name=. Parentheses permit multiline
calls and expressions without creating an indentation block.
Only sixteen words are refused as names, and only where a name is bound (a
state, prop, parameter, let, for item, shape name, …): when, if, else,
for, in, match, case, as, fn, and, or, not, true, false,
none, some. Every other keyword (key, state, from, refresh, view, …)
is an ordinary name there, so action searchKey(key: string) and action refresh
compile. Shape fields, named arguments and members take any word
(grammar).
contract vocab prints the card, what an app writes in one read (at most 12 KB: every
function, the tags with their attributes and events, each part's call, the test steps,
the agent's operations, and how to do a second screen, a sheet, a timer, colour, data, a
test; docs/card.md is the same text, checked in); contract vocab --all lists every built-in tag, attribute, CSS
property and standard function the compiler accepts, with each property's value kind and
default and each function's signature; contract vocab <name> answers for one (a function's rules and
an example too: contract vocab formatDate), or says what to write instead
(contract vocab sort). Check there before guessing at CSS or a function.
Is this helpful
Last updated November 30, 2026