View
Overview
This page covers:
Common fields of ordinary view nodes inside
viewScreen/viewTemplateidmountModechildrenControl type navigation and semantic entry
This page does not cover field-level details such as layout / placement / style / props / events / animations. See the corresponding documents for those.
Common Field Table
Key |
Type |
Default |
Required |
Description |
|---|---|---|---|---|
|
view type enum, see |
none |
Yes |
Control type, e.g. |
|
string |
none |
Yes |
Current node id |
|
|
|
No |
Meaningful only for |
|
object |
baseline |
No |
How the current node lays out its direct children |
|
object |
baseline |
No |
How the current node is placed by its parent |
|
object |
theme merge result |
No |
Visual style |
|
object |
|
No |
Local style overrides for interactive states, see State Styles |
|
object |
|
No |
Local style overrides for control parts (such as |
|
string array |
|
No |
References named styles in the current Runtime theme, overlaid in array order |
|
string array |
|
No |
References an |
|
array |
|
No |
Event declarations |
|
array |
|
No |
Declarative animations |
|
object |
|
No |
Store bindings |
|
array |
|
No |
Child node list |
For the full props fields, see Props.
Stylerefs
styleRefs reuses named styles in the Runtime theme. A named style key must contain ., e.g.
shell.card or shell.pageTitle.
The composition order (low to high priority) is: built-in theme, the current theme's all/control type, styleRefs, then the node's own
style, stateStyles, partStyles. So a node's own style / stateStyles / partStyles always has higher priority.
For the full layered composition rules, see Style. A missing style ref is skipped with a warning.
{
"type": "label",
"id": "title",
"styleRefs": ["shell.pageTitle"],
"labelProps": {
"text": "Apps"
}
}
Interactionrefs
interactionRefs reuses an interactionTemplate declared in a document asset. The template's events / animations
are prepended to the node's local declarations, while commonProps / stateStyles merge as defaults; node-local fields take precedence.
Unlike styleRefs, referencing a non-existent interactionTemplate is a hard parse error (document parsing fails) rather than a skip-and-warn.
{
"type": "button",
"id": "install",
"interactionRefs": ["press.scale"],
"events": [{"type": "clicked", "action": "store.install"}]
}
Id
Must be unique under the same parent node.
Top-level
screenand top-level template ids must be unique within the same document.
Mountmode
Currently meaningful only for viewScreen.
Value |
Meaning |
|---|---|
|
Creates the screen subtree at document load; suitable for resident pages or pages that should be visible right after startup |
|
Creates the screen subtree on first mount; suitable for rarely used pages to reduce the document's initial load cost |
Type
For an ordinary view node, type decides the control type and the dedicated props fields available. Screens and templates are expressed with the asset types
viewScreen / viewTemplate and are not written as ordinary child nodes.
Value |
Meaning |
Dedicated props |
|---|---|---|
|
Ordinary container |
none |
|
Text label |
|
|
Button container |
None; add a child |
|
Image control |
|
|
Text input box |
|
|
Slider |
|
|
Switch |
|
|
Checkbox |
|
|
Dropdown selection |
|
|
Progress bar |
|
|
Loading indicator |
none |
|
Arc progress / knob control |
|
|
Polyline / line-segment control |
|
|
Table control |
|
|
On-screen keyboard |
|
|
Canvas control |
|
|
Off-screen render framebuffer control |
|
type uses the camelCase spelling from the table above.
Children
children is an optional array. Each child node is itself an ordinary control node or a templateRef parser directive.
Constraints:
viewScreenis not allowed insidechildren.Child node
idmust be unique under the same parent.A child node can keep its own
children.Use
templateRefto statically instantiate aviewTemplate; inside a template,slotexposes replaceable subtrees, see Viewtemplate.placement.relativeTomust use a${view.*}file-root-relative path, e.g.${view.anchor}or${view.host.anchor}.