1
---
2
name: powerapps-canvas-yaml-generator
3
description: Generates valid, importable Power Apps Source Code YAML for canvas app screens. Use when asked to create YAML, scaffold, or modify any Power Apps canvas app screen — including full screens, dialogs, forms, galleries, detail views, dashboards, or any layout container — or when asked to generate Power Fx formulas or produce Power Apps source code for import.
4
---
5
6
# Power Apps Canvas App YAML Generator
7
8
Generates production-ready Power Apps Source Code YAML for canvas app screens, following the official Power Apps YAML source format rules and a consistent enterprise design system.
9
10
---
11
12
## Before Starting
13
14
**Always confirm the following before generating any YAML:**
15
16
1. **Screen or component name** — what to name the output (e.g. `ScnDashboard`, `ScnRequestForm`, `DlgConfirmDelete`)
17
2. **Component type** — full screen, dialog/overlay, form, gallery list, detail view, dashboard, or other
18
3. **Navigation context** — if a sidebar is needed, which nav item should be active; if no sidebar is needed, say so
19
4. **Screen purpose** — one sentence describing what the screen or component does
20
5. **Data source** — SharePoint list, Dataverse table, or collection name and any known column names (if data-driven)
21
6. **Controls needed** — gallery, form fields, dropdowns, status badges, buttons, dialogs, etc.
22
23
If any detail is missing, ask before generating.
24
25
---
26
27
## Step 1: Confirm the Component Type
28
29
The component type determines the top-level YAML structure:
30
31
- **Full screens** → wrapped in `Screens:` block
32
- **Dialogs, popups, components, partial UI** → bare container tree, NO `Screens:` wrapper
33
34
| Type | Screens: wrapper? | When to use |
35
| ------------------------------- | ----------------- | ---------------------------------------------------------------------- |
36
| **Full screen with sidebar** | YES | A primary app screen with global navigation |
37
| **Full screen without sidebar** | YES | A login, splash, or single-purpose screen |
38
| **Dialog / overlay / popup** | NO | A confirmation, quick-entry panel, or modal overlaid on another screen |
39
| **Reusable component / card** | NO | A panel, card, or UI fragment embedded within a screen |
40
| **Standalone form screen** | YES | A dedicated create or edit screen without a sidebar |
41
| **Gallery list screen** | YES | A searchable, filterable list of records |
42
| **Detail view screen** | YES | A read-only or editable single-record view |
43
| **Dashboard screen** | YES | A summary screen with KPI cards |
44
| **Custom / other** | Ask | Describe it |
45
46
---
47
48
## Step 2: Design System
49
50
### Colours
51
52
| Token | Value | Use |
53
| ------------------ | --------------------------- | ----------------------------- |
54
| Navy primary | `RGBA(13, 44, 84, 1)` | Sidebar fill, primary buttons |
55
| Navy dark hover | `RGBA(8, 30, 60, 1)` | Primary button hover |
56
| Page background | `RGBA(245, 246, 248, 1)` | Main content area |
57
| White | `RGBA(255, 255, 255, 1)` | Cards, panels, top bar |
58
| Border | `RGBA(226, 232, 240, 1)` | Card borders, dividers |
59
| Table header bg | `RGBA(248, 250, 252, 1)` | Gallery header row |
60
| Text primary | `RGBA(15, 23, 42, 1)` | Page titles, headings |
61
| Text secondary | `RGBA(71, 85, 105, 1)` | Body text |
62
| Text muted | `RGBA(100, 116, 139, 1)` | Breadcrumbs, subtitles |
63
| Nav active fill | `RGBA(255, 255, 255, 0.08)` | Active nav item background |
64
| Nav inactive fill | `RGBA(0, 0, 0, 0)` | Inactive nav item background |
65
| Nav label active | `RGBA(255, 255, 255, 1)` | Active nav label |
66
| Nav label inactive | `RGBA(255, 255, 255, 0.65)` | Inactive nav label |
67
68
### Status Badge Colours
69
70
| Category | Fill | Text |
71
| ----------------------------- | ------------------------ | ---------------------- |
72
| Available / Active / Success | `RGBA(220, 252, 231, 1)` | `RGBA(22, 101, 52, 1)` |
73
| Assigned / In Progress / Info | `RGBA(219, 234, 254, 1)` | `RGBA(30, 64, 175, 1)` |
74
| Pending / Warning | `RGBA(254, 243, 199, 1)` | `RGBA(146, 64, 14, 1)` |
75
| Error / Rejected / Urgent | `RGBA(254, 226, 226, 1)` | `RGBA(185, 28, 28, 1)` |
76
| Inactive / Neutral / Closed | `RGBA(241, 245, 249, 1)` | `RGBA(71, 85, 105, 1)` |
77
78
Apply the category that best matches the app's status vocabulary.
79
80
### Typography
81
82
Font-related properties for all classic controls: `Font`, `Size`, `FontWeight`. Note: `FontSize` does NOT exist — always use `Size`.
83
84
| Use | `Size` value | `FontWeight` value |
85
| ------------------------ | ------------ | ---------------------------------------------- |
86
| Page title | `=28` | `=FontWeight.Bold` |
87
| Panel / section title | `=16` | `=FontWeight.Semibold` |
88
| Body / button | `=13` | `=FontWeight.Normal` or `=FontWeight.Semibold` |
89
| Breadcrumb / small label | `=12` | `=FontWeight.Normal` |
90
| Nav label | `=11` | `=FontWeight.Normal` or `=FontWeight.Semibold` |
91
| Table column header | `=10` | `=FontWeight.Semibold` (ALL CAPS text) |
92
93
`Font`: always `=Font.'Segoe UI'`
94
95
### AutoLayout Container Properties
96
97
When using `Variant: AutoLayout`, apply these layout properties as needed:
98
99
| Property | Common values |
100
| --------------------------------------------------------------- | ------------------------------------------------------------------------------------------------ |
101
| `LayoutDirection` | `=LayoutDirection.Horizontal` or `=LayoutDirection.Vertical` |
102
| `LayoutAlignItems` | `=LayoutAlignItems.Center`, `=LayoutAlignItems.Stretch`, `=LayoutAlignItems.Start` |
103
| `LayoutJustifyContent` | `=LayoutJustifyContent.Start`, `=LayoutJustifyContent.SpaceBetween`, `=LayoutJustifyContent.End` |
104
| `LayoutGap` | `=8`, `=10`, `=12`, `=16` |
105
| `LayoutMinHeight` | `=16` (set on all AutoLayout containers) |
106
| `LayoutMinWidth` | `=16` or a meaningful minimum e.g. `=100`, `=200` |
107
| `LayoutMaxHeight` | `=Self.AllItemsCount * Self.TemplateHeight` (galleries) |
108
| `PaddingTop` / `PaddingBottom` / `PaddingLeft` / `PaddingRight` | `=8`, `=16`, `=20`, `=24`, `=32` |
109
| `FillPortions` | `=0` when container has a fixed `Height` or `Width`; omit to flex-fill |
110
| `AlignInContainer` | `=AlignInContainer.Start`, `=AlignInContainer.Center`, `=AlignInContainer.Stretch` |
111
| `DropShadow` | `=DropShadow.None` (explicit no-shadow), `=DropShadow.Light`, `=DropShadow.Regular` |
112
113
**Gallery-specific properties:**
114
| Property | Typical value |
115
|---|---|
116
| `TemplateSize` | `=45`, `=52`, `=60` (row height in px) |
117
| `TemplatePadding` | `=0` |
118
| `LayoutMinHeight` | `=45` or `=200` |
119
| `LayoutMaxHeight` | `=Self.AllItemsCount * Self.TemplateHeight` |
120
| `Height` | `=Self.AllItemsCount * Self.TemplateHeight` |
121
122
---
123
124
## Step 3: Power Apps YAML Syntax Rules
125
126
**All rules are absolute. Violating any one produces a PA1001 import error. Verify every rule before outputting.**
127
128
---
129
130
### RULE 0 — YAML indentation is mandatory and must be exact
131
132
**The single most common cause of import failure is missing or collapsed indentation.** YAML structure is defined entirely by indentation. If indentation is lost, every node appears at the wrong level and the parser rejects the file immediately.
133
134
**Output YAML inside a fenced code block** (` ```yaml `) so indentation is preserved exactly. Never output YAML as plain prose or a flat list.
135
136
The indentation contract for Power Apps Source Code YAML is **2 spaces per level**. Every level of nesting adds exactly 2 spaces. No tabs. No 4-space indents.
137
138
```
139
Screens: <- level 0, 0 spaces
140
ScreenName: <- level 1, 2 spaces
141
Fill: =RGBA(...) <- level 2, 4 spaces
142
Children: <- level 2, 4 spaces
143
- ControlName: <- level 3, 6 spaces (the - counts as part of indent)
144
Control: ... <- level 4, 10 spaces (4 spaces after the -)
145
Variant: ... <- level 4, 10 spaces
146
Properties: <- level 4, 10 spaces
147
PropName: =value <- level 5, 12 spaces
148
Children: <- level 4, 10 spaces
149
- ChildName: <- level 5, 14 spaces
150
Control: ... <- level 6, 16 spaces
151
Properties: <- level 6, 16 spaces
152
PropName: =val <- level 7, 18 spaces
153
```
154
155
The rule for list items (controls inside `Children:`): the `- ControlName:` line is at the list level, and the control's body (`Control:`, `Variant:`, `Properties:`, `Children:`) is indented **4 more spaces** relative to the `-`.
156
157
**Wrong — no indentation (causes immediate PA1001):**
158
159
```
160
Screens:
161
DlgAreYouSure:
162
Fill: =RGBA(0, 0, 0, 0)
163
Children:
164
- conDialogBackdrop:
165
Control: GroupContainer@1.5.0
166
```
167
168
**Correct — proper 2-space indentation:**
169
170
```yaml
171
Screens:
172
DlgAreYouSure:
173
Fill: =RGBA(0, 0, 0, 0)
174
Children:
175
- conDialogBackdrop:
176
Control: GroupContainer@1.5.0
177
Variant: ManualLayout
178
Properties:
179
Fill: =RGBA(0, 0, 0, 0.4)
180
```
181
182
---
183
184
### RULE 1 — Property values are NEVER quoted
185
186
The Source Code schema does not use quoted strings for property values. Quoting causes PA1001.
187
188
```yaml
189
# WRONG — quoted values, all cause import errors
190
Fill: "=RGBA(13, 44, 84, 1)"
191
Width: "=230"
192
Text: "=ThisItem.Title"
193
Variant: "AutoLayout"
194
195
# CORRECT — bare, unquoted
196
Fill: =RGBA(13, 44, 84, 1)
197
Width: =230
198
Text: =ThisItem.Title
199
Variant: AutoLayout
200
```
201
202
---
203
204
### RULE 2 — Every property value starts with =
205
206
Every value inside a `Properties:` block is a Power Fx expression and must start with `=`. No exceptions for any type.
207
208
| Type | WRONG | CORRECT |
209
| ------- | ----------------------------- | ------------------------------ |
210
| String | `Text: Hello` | `Text: ="Hello"` |
211
| Number | `Width: 230` | `Width: =230` |
212
| Boolean | `Visible: true` | `Visible: =true` |
213
| Colour | `Fill: RGBA(13,44,84,1)` | `Fill: =RGBA(13, 44, 84, 1)` |
214
| Enum | `FontWeight: FontWeight.Bold` | `FontWeight: =FontWeight.Bold` |
215
| Formula | `Height: Parent.Height` | `Height: =Parent.Height` |
216
217
The **only** values without `=` are the schema declaration keys — `Control:` and `Variant:` — which are type/schema keywords, not formulas.
218
219
---
220
221
### RULE 2b — Font size property is `Size:`, never `FontSize:`
222
223
The property name for font size on all classic controls (`Label@2.5.1`, `Classic/Button@2.2.0`, `Classic/TextInput@2.3.2`, `Classic/ComboBox@2.3.0`, etc.) is `Size`. The property `FontSize` does not exist and causes PA2108 on import.
224
225
```yaml
226
# WRONG — FontSize does not exist, causes PA2108
227
- lblTitle:
228
Control: Label@2.5.1
229
Properties:
230
FontSize: =16 # INVALID property name
231
232
# CORRECT — use Size
233
- lblTitle:
234
Control: Label@2.5.1
235
Properties:
236
Size: =16 # correct property name
237
Font: =Font.'Segoe UI'
238
FontWeight: =FontWeight.Semibold
239
Color: =RGBA(15, 23, 42, 1)
240
```
241
242
This applies to every versioned classic control. `Font`, `FontWeight`, and `Size` are the three font-related properties.
243
244
---
245
246
### RULE 3 — Use `Control:` not `ControlType:`
247
248
`ControlType:` does not exist in the Source Code schema. Always use `Control:` with the full versioned type string.
249
250
```yaml
251
# WRONG — invalid key, and quoted
252
- conPanel:
253
ControlType: "GroupContainer"
254
255
# CORRECT — correct key, unquoted, with version
256
- conPanel:
257
Control: GroupContainer@1.5.0
258
```
259
260
---
261
262
### RULE 4 — `Variant:` is a sibling of `Control:`, never inside `Properties:`
263
264
```yaml
265
# WRONG
266
- conPanel:
267
Control: GroupContainer@1.5.0
268
Properties:
269
Variant: AutoLayout # inside Properties is wrong
270
271
# CORRECT
272
- conPanel:
273
Control: GroupContainer@1.5.0
274
Variant: AutoLayout # sibling of Control, outside Properties
275
Properties:
276
LayoutDirection: =LayoutDirection.Vertical
277
```
278
279
---
280
281
### RULE 5 — Screen-level structure: `Properties:` + `Children:` as siblings
282
283
Screens support an **optional** `Properties:` block for screen-level properties, followed by `Children:` as a **sibling** — not nested inside `Properties:`.
284
285
Valid screen-level `Properties:` keys: `OnVisible`, `OnHidden`, `LoadingSpinnerColor`. That is all. `Fill`, `Height`, `Width`, and `DisplayName` are still NOT valid here.
286
287
`Children:` is always a direct sibling of `Properties:` under the screen name — never nested inside `Properties:`.
288
289
```yaml
290
# CORRECT — Properties: block with OnVisible, then Children: as sibling
291
Screens:
292
ScnMyScreen:
293
Properties:
294
LoadingSpinnerColor: =RGBA(13, 44, 84, 1)
295
OnVisible: |
296
=ClearCollect(colItems, MyList);
297
UpdateContext({locSearch: ""})
298
Children: <- sibling of Properties:, NOT inside it
299
- conShell:
300
Control: GroupContainer@1.5.0
301
Variant: AutoLayout
302
Properties: <- this Properties: belongs to conShell, not the screen
303
Fill: =RGBA(245, 246, 248, 1)
304
Height: =Parent.Height
305
Width: =Parent.Width
306
...
307
308
# ALSO CORRECT — no Properties: block at all (when no screen-level props needed)
309
Screens:
310
ScnMyScreen:
311
Children:
312
- conShell:
313
...
314
315
# WRONG — Fill/Height/Width at screen level (still invalid)
316
Screens:
317
ScnMyScreen:
318
Properties:
319
Fill: =RGBA(245, 246, 248, 1) # INVALID screen property
320
Height: =App.Height # INVALID screen property
321
Width: =App.Width # INVALID screen property
322
323
# WRONG — Children: nested inside Properties: (structural error)
324
Screens:
325
ScnMyScreen:
326
Properties:
327
OnVisible: |
328
=UpdateContext({locSearch: ""})
329
Children: # WRONG — Children: must be a sibling, not inside Properties:
330
- conShell:
331
```
332
333
### RULE 5b —### RULE 5b — Dialogs, popups, and components are NOT wrapped in `Screens:`
334
335
When the request is for a **dialog, popup, overlay, reusable component, or any partial UI** (not a full standalone screen), do NOT wrap it in a `Screens:` block. Output a bare container tree starting with a `- ContainerName:` list item.
336
337
**Wrong — dialog incorrectly wrapped in Screens:**
338
339
```yaml
340
Screens:
341
DlgConfirm:
342
Children:
343
- conDialogBackdrop: ...
344
```
345
346
**Correct — dialog as a bare container tree (no Screens: wrapper):**
347
348
```yaml
349
- conDialogBackdrop:
350
Control: GroupContainer@1.5.0
351
Variant: ManualLayout
352
Properties:
353
X: =0
354
Y: =0
355
Width: =Parent.Width
356
Height: =Parent.Height
357
Fill: =RGBA(0, 0, 0, 0.4)
358
RadiusTopLeft: =0
359
RadiusTopRight: =0
360
RadiusBottomLeft: =0
361
RadiusBottomRight: =0
362
Children:
363
- conDialogPanel:
364
Control: GroupContainer@1.5.0
365
Variant: AutoLayout
366
Properties:
367
X: =(Parent.Width - 480) / 2
368
Y: =(Parent.Height - 240) / 2
369
Width: =480
370
FillPortions: =0
371
Fill: =RGBA(255, 255, 255, 1)
372
LayoutDirection: =LayoutDirection.Vertical
373
LayoutGap: =16
374
PaddingTop: =24
375
PaddingBottom: =24
376
PaddingLeft: =24
377
PaddingRight: =24
378
LayoutMinHeight: =16
379
LayoutMinWidth: =16
380
RadiusTopLeft: =12
381
RadiusTopRight: =12
382
RadiusBottomLeft: =12
383
RadiusBottomRight: =12
384
```
385
386
**Use `Screens:` only when generating a full standalone app screen.**
387
Use a bare container tree for: dialogs, popups, overlays, reusable card components, form panels, and any partial UI meant to be embedded within an existing screen.
388
389
---
390
391
### RULE 6 — No `BorderRadius:` — use four `Radius*` properties
392
393
`BorderRadius` is not a valid property in the Source Code schema.
394
395
```yaml
396
# WRONG
397
BorderRadius: =6
398
399
# CORRECT — always all four, even if all the same value
400
RadiusTopLeft: =8
401
RadiusTopRight: =8
402
RadiusBottomLeft: =8
403
RadiusBottomRight: =8
404
```
405
406
Every `GroupContainer` must include all four radius properties. Use `=0` for square corners.
407
408
---
409
410
### RULE 7 — Multi-line formulas use block scalar; `=` goes inside the block
411
412
Two block scalar styles are used — pick based on content:
413
414
**`|-`** — for a **single expression** that spans multiple lines (no `;` between statements). The `|-` strips the trailing newline. Use for `Fill`, `Items`, `Color`, and any single multi-line formula:
415
416
```yaml
417
Fill: |-
418
=If(
419
locIsActive,
420
RGBA(255, 255, 255, 0.08),
421
RGBA(0, 0, 0, 0)
422
)
423
424
Items: |-
425
=AddColumns(
426
Filter(MyList, Status = "Active"),
427
"Extra", Value(ID)
428
)
429
```
430
431
**`|`** — for **multiple statements** separated by `;`. Use for `OnSelect`, `OnVisible`, `OnHidden`:
432
433
```yaml
434
OnSelect: |
435
=Set(gblSelectedItem, ThisItem);
436
Navigate(ScnDetail);
437
Set(gblMode, "Edit")
438
439
OnVisible: |
440
=ClearCollect(colItems, MyList);
441
UpdateContext({locSearch: ""})
442
```
443
444
Both `|` and `|-` are accepted by the parser for `OnSelect`/`OnVisible`. Either is valid:
445
446
```yaml
447
# Also valid — |- on multi-statement OnSelect
448
OnSelect: |-
449
=Set(gblFrmMode, "New");
450
Navigate(ScnDetail)
451
```
452
453
The `=` always goes on the **first line inside the block**, never on the key line itself.
454
455
---
456
457
### RULE 7b — Formulas containing `{` (record literals) must use block scalar
458
459
YAML treats `: ` (colon-space) as a mapping separator. Power Fx record literals like `{varName: value}` contain this pattern and will break inline parsing with "found invalid mapping".
460
461
**Any formula that contains `{` must use `|` or `|-` block scalar.**
462
463
Single-line formulas WITHOUT `{` are fine inline:
464
465
```yaml
466
# Fine inline — no { } present
467
OnSelect: =Navigate(ScnDetail)
468
OnSelect: =Back()
469
Items: =Filter('Software Assets', Status.Value = "Active")
470
Visible: =locDialogVisible
471
```
472
473
```yaml
474
# WRONG — colon inside {} breaks YAML parsing (PA1001 "invalid mapping")
475
OnSelect: =UpdateContext({locDialogResult: false, locDialogVisible: false})
476
OnSelect: =Patch('My List', Defaults('My List'), {Title: txtName.Text})
477
OnSelect: =Navigate(ScnHome, {locUser: varCurrentUser})
478
479
# CORRECT — use | block scalar whenever the formula contains `: `
480
OnSelect: |
481
=UpdateContext({locDialogResult: false, locDialogVisible: false})
482
483
OnSelect: |
484
=Patch('My List', Defaults('My List'), {Title: txtName.Text})
485
486
OnSelect: |
487
=Navigate(ScnHome, {locUser: varCurrentUser})
488
```
489
490
This applies to **any property**, not just `OnSelect`:
491
492
```yaml
493
# WRONG — colon inside formula value
494
Items: =Filter(MyTable, {Status: "Active"})
495
Default: ={Value: "All"}
496
497
# CORRECT
498
Items: |
499
=Filter(MyTable, {Status: "Active"})
500
Default: |
501
={Value: "All"}
502
```
503
504
**The safe rule: if the formula contains `{`, always use `|` block scalar.**
505
506
---
507
508
### RULE 8 — `ManualLayout` only for overlays and badges; `AutoLayout` for everything else
509
510
- **`Variant: ManualLayout`** — dialog backdrops, dialog panels that need explicit `X`/`Y`, status badges
511
- **`Variant: AutoLayout`** — all other containers (shells, sidebars, top bars, body areas, card panels, form rows, button rows)
512
513
Using `ManualLayout` where `AutoLayout` is needed means children all pile at position 0,0.
514
515
---
516
517
### RULE 9 — No `DisplayName`, no `#` comments in generated YAML
518
519
- `DisplayName` is not a valid property anywhere — never emit it
520
- Do not add `#` YAML comments inside the generated YAML block
521
522
---
523
524
### RULE 10 — Delegable filtering only; no `Search()` or `in` operator
525
526
```yaml
527
Items: |-
528
=Filter('DataSource',
529
(locFilterStatus = "All" || StatusColumn = locFilterStatus),
530
StartsWith(TitleColumn, locSearchText)
531
)
532
```
533
534
Never use `Search()` or the `in` operator — they are not delegable against SharePoint or Dataverse.
535
536
---
537
538
## Step 4: Control Reference
539
540
| Purpose | Control declaration |
541
| -------------------------------- | ------------------------------------------------------------------------------ |
542
| Layout container (stack/flex) | `Control: GroupContainer@1.5.0` + `Variant: AutoLayout` |
543
| Grid layout container | `Control: GroupContainer@1.5.0` + `Variant: GridLayout` |
544
| Overlay / badge (X,Y positioned) | `Control: GroupContainer@1.5.0` + `Variant: ManualLayout` |
545
| Button | `Control: Classic/Button@2.2.0` |
546
| Single-line text input | `Control: Classic/TextInput@2.3.2` |
547
| Multi-line text input | `Control: Classic/TextInput@2.3.2` + `Mode: =TextMode.MultiLine` in Properties |
548
| Classic dropdown | `Control: Classic/ComboBox@2.3.0` |
549
| Modern dropdown | `Control: ModernCombobox@1.1.0` |
550
| Date picker | `Control: Classic/DatePicker@2.6.0` |
551
| Icon | `Control: Classic/Icon@2.5.0` |
552
| Label | `Control: Label@2.5.1` |
553
| Vertical gallery | `Control: Gallery@2.15.0` + `Variant: Vertical` |
554
| Canvas component (reusable) | `Control: CanvasComponent` + `ComponentName: myComponentName` |
555
| Toggle | `Control: Classic/Toggle@2.2.0` |
556
| Checkbox | `Control: Classic/Checkbox@2.1.0` |
557
558
**GridLayout container properties:**
559
560
```yaml
561
- conGrid:
562
Control: GroupContainer@1.5.0
563
Variant: GridLayout
564
Properties:
565
LayoutGridColumns: =6
566
LayoutGridRows: =1
567
Height: =140
568
FillPortions: =0
569
LayoutMinHeight: =16
570
LayoutMinWidth: =16
571
```
572
573
**CanvasComponent usage:**
574
575
```yaml
576
- comp_mySidebar:
577
Control: CanvasComponent
578
ComponentName: sideBar <- no = prefix, no quotes; this is a schema declaration
579
Properties:
580
ActiveScreen: =App.ActiveScreen
581
Height: =Parent.Height
582
Width: =230
583
```
584
585
**Invisible tap-target button** (full-width overlay over a gallery row — `Text: =` with empty formula is valid):
586
587
```yaml
588
- btnRowTapTarget:
589
Control: Classic/Button@2.2.0
590
Properties:
591
Fill: =RGBA(0, 0, 0, 0)
592
BorderStyle: =BorderStyle.None
593
Height: =Parent.TemplateHeight
594
Width: =Parent.Width
595
Text: =
596
HoverFill: =RGBA(56, 96, 178, 0.1)
597
OnSelect: |
598
=Set(gblSelectedItem, ThisItem);
599
Navigate(ScnDetail)
600
```
601
602
### Naming Conventions
603
604
| Element | Prefix | Example |
605
| ----------------- | ------ | ------------------------------------ |
606
| Containers | `con` | `conTopBar`, `conDialogPanel` |
607
| Labels | `lbl` | `lblPageTitle`, `lblFieldName` |
608
| Buttons | `btn` | `btnSave`, `btnCancel` |
609
| Icons | `icn` | `icnSearch`, `icnClose` |
610
| Galleries | `gal` | `galRecordList` |
611
| Text inputs | `txt` | `txtSearch`, `txtName` |
612
| Combo boxes | `cmb` | `cmbStatusFilter` |
613
| Date pickers | `dtp` | `dtpStartDate` |
614
| Toggles | `tog` | `togIsActive` |
615
| Checkboxes | `chk` | `chkAgree` |
616
| Context variables | `loc` | `locSearchText`, `locSelectedRecord` |
617
| Collections | `col` | `colStatusOptions` |
618
| Global variables | `var` | `varCurrentUser` |
619
620
---
621
622
## Step 5: Canonical Reference Examples
623
624
These are complete, correct examples. Every generated YAML must match this syntax exactly.
625
626
### Example A: Confirmation Dialog (complete, bare container — no Screens: wrapper)
627
628
```yaml
629
- conDialogBackdrop:
630
Control: GroupContainer@1.5.0
631
Variant: ManualLayout
632
Properties:
633
X: =0
634
Y: =0
635
Width: =Parent.Width
636
Height: =Parent.Height
637
Fill: =RGBA(0, 0, 0, 0.4)
638
RadiusTopLeft: =0
639
RadiusTopRight: =0
640
RadiusBottomLeft: =0
641
RadiusBottomRight: =0
642
Children:
643
- conDialogPanel:
644
Control: GroupContainer@1.5.0
645
Variant: AutoLayout
646
Properties:
647
X: =(Parent.Width - 480) / 2
648
Y: =(Parent.Height - 240) / 2
649
Width: =480
650
FillPortions: =0
651
Fill: =RGBA(255, 255, 255, 1)
652
BorderColor: =RGBA(226, 232, 240, 1)
653
BorderThickness: =1
654
RadiusTopLeft: =12
655
RadiusTopRight: =12
656
RadiusBottomLeft: =12
657
RadiusBottomRight: =12
658
LayoutDirection: =LayoutDirection.Vertical
659
LayoutGap: =16
660
PaddingTop: =24
661
PaddingBottom: =24
662
PaddingLeft: =24
663
PaddingRight: =24
664
LayoutMinHeight: =16
665
LayoutMinWidth: =16
666
Children:
667
- conDialogHeader:
668
Control: GroupContainer@1.5.0
669
Variant: AutoLayout
670
Properties:
671
FillPortions: =0
672
Fill: =RGBA(0, 0, 0, 0)
673
LayoutDirection: =LayoutDirection.Horizontal
674
LayoutAlignItems: =LayoutAlignItems.Center
675
LayoutJustifyContent: =LayoutJustifyContent.SpaceBetween
676
LayoutMinHeight: =16
677
LayoutMinWidth: =16
678
RadiusTopLeft: =0
679
RadiusTopRight: =0
680
RadiusBottomLeft: =0
681
RadiusBottomRight: =0
682
Children:
683
- lblDialogTitle:
684
Control: Label@2.5.1
685
Properties:
686
Text: ="Are you sure?"
687
Size: =16
688
FontWeight: =FontWeight.Semibold
689
Color: =RGBA(15, 23, 42, 1)
690
Font: =Font.'Segoe UI'
691
- lblDialogMessage:
692
Control: Label@2.5.1
693
Properties:
694
Text: ="This action cannot be undone. Please confirm."
695
Size: =13
696
FontWeight: =FontWeight.Normal
697
Color: =RGBA(71, 85, 105, 1)
698
Font: =Font.'Segoe UI'
699
- conDialogFooter:
700
Control: GroupContainer@1.5.0
701
Variant: AutoLayout
702
Properties:
703
FillPortions: =0
704
Fill: =RGBA(0, 0, 0, 0)
705
LayoutDirection: =LayoutDirection.Horizontal
706
LayoutJustifyContent: =LayoutJustifyContent.End
707
LayoutGap: =8
708
LayoutMinHeight: =16
709
LayoutMinWidth: =16
710
RadiusTopLeft: =0
711
RadiusTopRight: =0
712
RadiusBottomLeft: =0
713
RadiusBottomRight: =0
714
Children:
715
- btnCancel:
716
Control: Classic/Button@2.2.0
717
Properties:
718
Text: ="Cancel"
719
Size: =13
720
Font: =Font.'Segoe UI'
721
Fill: =RGBA(255, 255, 255, 1)
722
Color: =RGBA(13, 44, 84, 1)
723
BorderColor: =RGBA(200, 210, 225, 1)
724
HoverFill: =RGBA(245, 246, 248, 1)
725
RadiusTopLeft: =6
726
RadiusTopRight: =6
727
RadiusBottomLeft: =6
728
RadiusBottomRight: =6
729
OnSelect: =Back()
730
- btnConfirm:
731
Control: Classic/Button@2.2.0
732
Properties:
733
Text: ="Confirm"
734
Size: =13
735
Font: =Font.'Segoe UI'
736
Fill: =RGBA(13, 44, 84, 1)
737
Color: =RGBA(255, 255, 255, 1)
738
HoverFill: =RGBA(8, 30, 60, 1)
739
RadiusTopLeft: =6
740
RadiusTopRight: =6
741
RadiusBottomLeft: =6
742
RadiusBottomRight: =6
743
OnSelect: |
744
=UpdateContext({locConfirmed: true});
745
Back()
746
```
747
748
---
749
750
### Example B: Full Screen with Sidebar (complete shell)
751
752
```yaml
753
Screens:
754
ScnExample:
755
Properties:
756
OnVisible: |
757
=ClearCollect(colStatusOptions, {Value: "All"}, {Value: "Open"}, {Value: "Closed"});
758
UpdateContext({locSearch: "", locFilterStatus: "All"})
759
Children:
760
- conShell:
761
Control: GroupContainer@1.5.0
762
Variant: AutoLayout
763
Properties:
764
Width: =Parent.Width
765
Height: =Parent.Height
766
LayoutDirection: =LayoutDirection.Horizontal
767
Fill: =RGBA(0, 0, 0, 0)
768
LayoutMinHeight: =16
769
LayoutMinWidth: =16
770
RadiusTopLeft: =0
771
RadiusTopRight: =0
772
RadiusBottomLeft: =0
773
RadiusBottomRight: =0
774
Children:
775
- conSidebar:
776
Control: GroupContainer@1.5.0
777
Variant: AutoLayout
778
Properties:
779
Width: =230
780
FillPortions: =0
781
Fill: =RGBA(13, 44, 84, 1)
782
LayoutDirection: =LayoutDirection.Vertical
783
LayoutMinHeight: =16
784
LayoutMinWidth: =16
785
RadiusTopLeft: =0
786
RadiusTopRight: =0
787
RadiusBottomLeft: =0
788
RadiusBottomRight: =0
789
Children:
790
- conNavItem1:
791
Control: GroupContainer@1.5.0
792
Variant: AutoLayout
793
Properties:
794
Height: =44
795
FillPortions: =0
796
Fill: =RGBA(255, 255, 255, 0.08)
797
LayoutDirection: =LayoutDirection.Horizontal
798
LayoutAlignItems: =LayoutAlignItems.Center
799
LayoutGap: =12
800
PaddingLeft: =16
801
LayoutMinHeight: =16
802
LayoutMinWidth: =16
803
RadiusTopLeft: =0
804
RadiusTopRight: =0
805
RadiusBottomLeft: =0
806
RadiusBottomRight: =0
807
Children:
808
- icnNavItem1:
809
Control: Classic/Icon@2.5.0
810
Properties:
811
Icon: =Icon.Waffle
812
Color: =RGBA(255, 255, 255, 1)
813
Width: =18
814
Height: =18
815
- lblNavItem1:
816
Control: Label@2.5.1
817
Properties:
818
Text: ="DASHBOARD"
819
Size: =11
820
Font: =Font.'Segoe UI'
821
Color: =RGBA(255, 255, 255, 1)
822
FontWeight: =FontWeight.Semibold
823
- conMain:
824
Control: GroupContainer@1.5.0
825
Variant: AutoLayout
826
Properties:
827
Fill: =RGBA(245, 246, 248, 1)
828
LayoutDirection: =LayoutDirection.Vertical
829
LayoutMinHeight: =16
830
LayoutMinWidth: =16
831
RadiusTopLeft: =0
832
RadiusTopRight: =0
833
RadiusBottomLeft: =0
834
RadiusBottomRight: =0
835
Children:
836
- conTopBar:
837
Control: GroupContainer@1.5.0
838
Variant: AutoLayout
839
Properties:
840
Height: =60
841
FillPortions: =0
842
Fill: =RGBA(255, 255, 255, 1)
843
LayoutDirection: =LayoutDirection.Horizontal
844
LayoutAlignItems: =LayoutAlignItems.Center
845
LayoutJustifyContent: =LayoutJustifyContent.SpaceBetween
846
PaddingLeft: =24
847
PaddingRight: =24
848
LayoutMinHeight: =16
849
LayoutMinWidth: =16
850
RadiusTopLeft: =0
851
RadiusTopRight: =0
852
RadiusBottomLeft: =0
853
RadiusBottomRight: =0
854
Children:
855
- lblBreadcrumb:
856
Control: Label@2.5.1
857
Properties:
858
Text: ="APP / SCREEN"
859
Size: =12
860
Font: =Font.'Segoe UI'
861
Color: =RGBA(100, 116, 139, 1)
862
- conBody:
863
Control: GroupContainer@1.5.0
864
Variant: AutoLayout
865
Properties:
866
Fill: =RGBA(245, 246, 248, 1)
867
LayoutDirection: =LayoutDirection.Vertical
868
LayoutGap: =16
869
PaddingTop: =32
870
PaddingBottom: =32
871
PaddingLeft: =32
872
PaddingRight: =32
873
LayoutMinHeight: =16
874
LayoutMinWidth: =16
875
RadiusTopLeft: =0
876
RadiusTopRight: =0
877
RadiusBottomLeft: =0
878
RadiusBottomRight: =0
879
Children:
880
- lblPageTitle:
881
Control: Label@2.5.1
882
Properties:
883
Text: ="Screen Title."
884
Size: =28
885
FontWeight: =FontWeight.Bold
886
Color: =RGBA(15, 23, 42, 1)
887
Font: =Font.'Segoe UI'
888
- lblPageSubtitle:
889
Control: Label@2.5.1
890
Properties:
891
Text: ="A short description of this screen."
892
Size: =13
893
FontWeight: =FontWeight.Normal
894
Color: =RGBA(100, 116, 139, 1)
895
Font: =Font.'Segoe UI'
896
```
897
898
---
899
900
### Example C: Standalone Form Screen
901
902
```yaml
903
Screens:
904
ScnRequestForm:
905
Properties:
906
OnVisible: |
907
=UpdateContext({locMode: "New"})
908
Children:
909
- conFormShell:
910
Control: GroupContainer@1.5.0
911
Variant: AutoLayout
912
Properties:
913
Width: =Parent.Width
914
Height: =Parent.Height
915
LayoutDirection: =LayoutDirection.Vertical
916
Fill: =RGBA(245, 246, 248, 1)
917
LayoutMinHeight: =16
918
LayoutMinWidth: =16
919
RadiusTopLeft: =0
920
RadiusTopRight: =0
921
RadiusBottomLeft: =0
922
RadiusBottomRight: =0
923
Children:
924
- conFormHeader:
925
Control: GroupContainer@1.5.0
926
Variant: AutoLayout
927
Properties:
928
Height: =60
929
FillPortions: =0
930
Fill: =RGBA(255, 255, 255, 1)
931
LayoutDirection: =LayoutDirection.Horizontal
932
LayoutAlignItems: =LayoutAlignItems.Center
933
LayoutJustifyContent: =LayoutJustifyContent.SpaceBetween
934
PaddingLeft: =24
935
PaddingRight: =24
936
LayoutMinHeight: =16
937
LayoutMinWidth: =16
938
RadiusTopLeft: =0
939
RadiusTopRight: =0
940
RadiusBottomLeft: =0
941
RadiusBottomRight: =0
942
Children:
943
- lblFormTitle:
944
Control: Label@2.5.1
945
Properties:
946
Text: ="New Request."
947
Size: =28
948
FontWeight: =FontWeight.Bold
949
Color: =RGBA(15, 23, 42, 1)
950
Font: =Font.'Segoe UI'
951
- conFormBody:
952
Control: GroupContainer@1.5.0
953
Variant: AutoLayout
954
Properties:
955
Fill: =RGBA(245, 246, 248, 1)
956
LayoutDirection: =LayoutDirection.Vertical
957
LayoutGap: =16
958
PaddingTop: =24
959
PaddingBottom: =24
960
PaddingLeft: =32
961
PaddingRight: =32
962
LayoutMinHeight: =16
963
LayoutMinWidth: =16
964
RadiusTopLeft: =0
965
RadiusTopRight: =0
966
RadiusBottomLeft: =0
967
RadiusBottomRight: =0
968
Children:
969
- conFieldTitle:
970
Control: GroupContainer@1.5.0
971
Variant: AutoLayout
972
Properties:
973
FillPortions: =0
974
Fill: =RGBA(0, 0, 0, 0)
975
LayoutDirection: =LayoutDirection.Vertical
976
LayoutGap: =4
977
LayoutMinHeight: =16
978
LayoutMinWidth: =16
979
RadiusTopLeft: =0
980
RadiusTopRight: =0
981
RadiusBottomLeft: =0
982
RadiusBottomRight: =0
983
Children:
984
- lblTitle:
985
Control: Label@2.5.1
986
Properties:
987
Text: ="Title"
988
Size: =12
989
FontWeight: =FontWeight.Semibold
990
Color: =RGBA(71, 85, 105, 1)
991
Font: =Font.'Segoe UI'
992
- txtTitle:
993
Control: Classic/TextInput@2.3.2
994
Properties:
995
HintText: ="Enter a title"
996
Font: =Font.'Segoe UI'
997
Size: =13
998
- conFormActions:
999
Control: GroupContainer@1.5.0
1000
Variant: AutoLayout
1001
Properties:
1002
Height: =64
1003
FillPortions: =0
1004
Fill: =RGBA(255, 255, 255, 1)
1005
LayoutDirection: =LayoutDirection.Horizontal
1006
LayoutJustifyContent: =LayoutJustifyContent.End
1007
LayoutAlignItems: =LayoutAlignItems.Center
1008
LayoutGap: =8
1009
PaddingRight: =24
1010
LayoutMinHeight: =16
1011
LayoutMinWidth: =16
1012
RadiusTopLeft: =0
1013
RadiusTopRight: =0
1014
RadiusBottomLeft: =0
1015
RadiusBottomRight: =0
1016
Children:
1017
- btnCancel:
1018
Control: Classic/Button@2.2.0
1019
Properties:
1020
Text: ="Cancel"
1021
Size: =13
1022
Font: =Font.'Segoe UI'
1023
Fill: =RGBA(255, 255, 255, 1)
1024
Color: =RGBA(13, 44, 84, 1)
1025
BorderColor: =RGBA(200, 210, 225, 1)
1026
HoverFill: =RGBA(245, 246, 248, 1)
1027
RadiusTopLeft: =6
1028
RadiusTopRight: =6
1029
RadiusBottomLeft: =6
1030
RadiusBottomRight: =6
1031
OnSelect: =Back()
1032
- btnSave:
1033
Control: Classic/Button@2.2.0
1034
Properties:
1035
Text: ="Save"
1036
Size: =13
1037
Font: =Font.'Segoe UI'
1038
Fill: =RGBA(13, 44, 84, 1)
1039
Color: =RGBA(255, 255, 255, 1)
1040
HoverFill: =RGBA(8, 30, 60, 1)
1041
RadiusTopLeft: =6
1042
RadiusTopRight: =6
1043
RadiusBottomLeft: =6
1044
RadiusBottomRight: =6
1045
OnSelect: |
1046
=Patch('My List', Defaults('My List'), {Title: txtTitle.Text});
1047
Back()
1048
```
1049
1050
---
1051
1052
## Step 6: Generate the YAML
1053
1054
Produce the complete YAML starting from `Screens:`. Follow the canonical examples in Step 5 exactly for syntax. Include:
1055
1056
- The correct component pattern based on Step 1
1057
- All navigation items if a sidebar is present, with exactly one active
1058
- Full top bar if applicable
1059
- Complete page body with all required controls
1060
- All `OnVisible` logic flat under the screen name (not inside a `Properties:` block)
1061
- All `OnSelect` logic for buttons and nav items
1062
1063
**Output format requirements — both are mandatory:**
1064
1065
1. **Always wrap the YAML in a fenced code block using ` ```yaml ` and ` ``` `.** Plain prose or unformatted output collapses indentation and produces an unimportable file.
1066
2. **Use exactly 2 spaces per indent level throughout.** No tabs. No 4-space indents. Every nesting level adds exactly 2 spaces. Control bodies inside `Children:` are indented 4 spaces after the `- ` list marker.
1067
1068
**Do not add `#` YAML comments inside the output block.**
1069
1070
**Before emitting each line, verify:**
1071
1072
1. Is the YAML inside a ` ```yaml ` code fence? If not, wrap it now
1073
2. Is indentation correct — 2 spaces per level, 4 spaces after `- ` for control body? Fix before continuing
1074
3. Is the value quoted? Remove the quotes
1075
4. Does the value start with `=`? Add it (except for `Control:` and `Variant:`)
1076
5. Is the key `ControlType:`? Change to `Control:`
1077
6. Is `Variant:` inside `Properties:`? Move it outside as a sibling of `Control:`
1078
7. Is this `Height`, `Width`, or `DisplayName` at screen level? Delete it
1079
8. Is there a `Properties:` wrapper at screen level? Delete it
1080
9. Is there a `BorderRadius:` property? Replace with four `Radius*` properties
1081
1082
---
1083
1084
## Step 7: Document Assumptions
1085
1086
After the YAML block, output:
1087
1088
```
1089
**Data Source Assumptions**
1090
- `ColumnName` -> what this field represents
1091
1092
**Design Assumptions**
1093
- [layout choices, status values, nav items, sizing, etc.]
1094
```
1095
1096
---
1097
1098
## Validation Checklist
1099
1100
Before outputting YAML, confirm every item is true:
1101
1102
- [ ] YAML is output inside a ```yaml fenced code block — never as plain unformatted text
1103
- [ ] Indentation is exactly 2 spaces per level; control bodies inside Children: are 4 spaces after the - list marker
1104
- [ ] No `FontSize:` property anywhere — font size is always `Size:` (PA2108 otherwise)
1105
- [ ] No property value is wrapped in quotes
1106
- [ ] Every value inside `Properties:` starts with `=`
1107
- [ ] Every control uses `Control:` not `ControlType:`
1108
- [ ] Every `Control:` value includes the version suffix (e.g. `GroupContainer@1.5.0`)
1109
- [ ] `Variant:` is a sibling of `Control:`, not inside `Properties:`
1110
- [ ] Component type determined first: dialogs/popups/components use bare container tree (no `Screens:` wrapper); only full standalone screens use `Screens:`
1111
- [ ] Screen-level `Properties:` block (if present) contains ONLY `OnVisible`, `OnHidden`, or `LoadingSpinnerColor` — `Fill`, `Height`, `Width`, and `DisplayName` are NOT valid screen properties
1112
- [ ] `Children:` is a SIBLING of `Properties:` at screen level, never nested inside `Properties:`
1113
- [ ] `Fill` is on the root container inside `Children:`, NOT in the screen-level `Properties:` block
1114
- [ ] No `BorderRadius:` — only `RadiusTopLeft`, `RadiusTopRight`, `RadiusBottomLeft`, `RadiusBottomRight`
1115
- [ ] Every `GroupContainer` has all four `Radius*` properties
1116
- [ ] Fixed-size containers have `FillPortions: =0`
1117
- [ ] AutoLayout containers include `LayoutMinHeight: =16` and `LayoutMinWidth: =16`
1118
- [ ] `ManualLayout` used only for overlays/backdrops and status badges
1119
- [ ] Any formula containing `{` (record literal) uses `|` block scalar — inline `OnSelect: =UpdateContext({...})` breaks YAML parsing with "invalid mapping"
1120
- [ ] Multi-line formulas use `|-` block scalar with `=` on the first line inside the block
1121
- [ ] `OnVisible` / `OnSelect` with multiple statements use `|`; no trailing semicolon after the last statement
1122
- [ ] No `Search()` or `in` operator — only `StartsWith()` and `Filter()`
1123
- [ ] No emoji or special Unicode in any `Text` value
1124
- [ ] No `DisplayName` property anywhere
1125
- [ ] No `#` YAML comments inside the YAML block
1126
- [ ] Font is `=Font.'Segoe UI'` throughout
1127
- [ ] Page title label text ends with a full stop
1128
- [ ] Data source and design assumptions documented after the YAML block
1129
1130
---
1131
1132
## References
1133
1134
- [Power Apps YAML source format](https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/power-apps-yaml)
1135
- [Power Fx delegable functions for SharePoint](https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/delegation-list)
1136
- [Power Apps controls reference](https://learn.microsoft.com/en-us/power-apps/maker/canvas-apps/reference-properties)
1137