---
title: "Views"
description: "How an element line parses: positional values, attributes, continuation lines and children, and the key that a for loop needs."
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

<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/reference/contract-grammar/views: <what was wrong or missing>"`

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

</AgentInstructions>

```ebnf
node          = element | component-use | view-if | for | view-match | children ;
element       = TAG { attribute | expr | special-word } NL [ element-body ] ;
attribute     = FIELD "=" expr | "autofocus" ;
element-body  = INDENT { continuation | element-part } { node } DEDENT ;
continuation  = FIELD "=" expr { attribute } NL ;
element-part  = "::" "placeholder" NL block(continuation) ;
component-use = CAPITALIZED_IDENT "(" [ named-args ] ")" NL [ node-children ] ;
named-args    = FIELD "=" expr { "," FIELD "=" expr } [ "," ] ;
node-children = INDENT node { node } DEDENT ;
view-if       = "if" expr block(node) [ "else" ( view-if | block(node) ) ] ;
for           = "for" IDENT [ "," IDENT ] "in" expr "key" "=" expr block(node) ;
view-match    = "match" expr block(view-case) ;
view-case     = "case" "some" "(" IDENT ")" block(node)
              | "case" "none" block(node) | "case" STRING block(node) ;
children      = "children" NL ;
special-word  = "document" | "switch" | "multiple" ;
```

`special-word` is contextual: `scroll document`, and the admitted input forms,
not three universal positional flags. The lowering pass restricts an element's
positional values, children, and properties. `button "Label"` inserts a text
child. `autofocus` is the bare boolean convenience spelling.

A deeper element line is treated as an attribute continuation only when it starts
with `name=`; once child nodes begin, later lines are children, not continuations.
Continuations may sit deeper than the children that follow them; `fmt` moves them
to the children's level.
A repeated attribute on one element is refused. A component use takes named
arguments; its name starts uppercase to distinguish it from an element.

A `for` key is a string, number, or boolean, with unique stable values required
for useful row identity. Its optional second binding is the numeric row index.
`if` conditions are boolean. Match an option with `case some(value)` and
`case none`. Match `page.platform` with a quoted host name per case. Root regions are
refused: wrap them in an element. `children` requires a declared slot.
