Controls grammar#
Controls grammar describes reusable UI controls and control properties that forms and app pages can compose.
Source#
| Property | Value |
|---|---|
| Grammar file | packages/business/language/grammar/controls.g4 |
| Grammar name | controls |
| Grammar kind | parser |
| Imports | common, expression, literal |
| Imported by | BusinessLanguage, module |
| Direct rule or token count | 8 |
How to use this page#
Read the examples first when authoring Business Language. Use the rule inventory when checking exact grammar coverage or when updating parser, lowering, editor, or documentation behavior.
Entry rules and syntax families#
Start with these rules when reading this grammar: controlDeclaration.
- Declarations:
controlDeclaration
Key grammar excerpts#
controlDeclaration#
controlDeclaration: annotation* accessModifier? CONTROL identifier controlHeader? OPEN_BRACE controlMember* CLOSE_BRACE;Complete rule and token inventory#
controlChildren, controlDeclaration, controlEvent, controlHeader, controlHeaderProperty, controlMember, controlProperty, controlPropertyKeyExamples#
Reusable control#
control MoneyInput {
label: "Amount";
bind: invoice.amount;
}Control property block#
control VendorPicker {
source: Vendor;
display: Vendor.vendor_name;
}Events and nested controls#
control VendorSummary {
label: "Vendor";
on change {
refresh_vendor_summary();
}
children: {
control VendorName {
bind: vendor.name;
}
}
}Common authoring mistakes#
- Do not copy examples without checking the rule inventory for the exact grammar boundary.
- Do not add behavior that depends on missing configuration or undeclared user-facing errors.
Related guides#
- /language/apps-forms-controls/
- /language/source-ui-layouts/
Authoring notes#
- Keep examples aligned with the grammar source, not with inferred syntax from another language.
- Use declared messages for user-facing failures, and fail closed when required configuration is absent.