render_layout
Generate a screen layout using nested rows and columns and save it with a profile and label. It returns warnings to fix overflow or truncated text.
Instructions
Lay out a screen from nested rows and columns (no pixel coordinates) and store it as (profile, label).
root fills the whole display. Containers split space between children; text can fit itself.
Always check warnings in the result: it reports truncated text, overflow and elements that got
no room, so you can fix the layout and render again (same label overwrites).
Nodes (every node accepts w, h in px and flex as a share of leftover space):
{"type":"column"|"row","children":[...],"gap":4,"padding":6,"align":"stretch|start|center|end",
"justify":"start|center|end|space-between","fill":colour,"border":px,"border_color":colour}
padding is a number, [vertical, horizontal] or [top, right, bottom, left].
align = cross axis (default stretch); justify = main axis when no child has flex.
{"type":"text","text":"..","size":12|"fit","bold":false,"color":"black","align":"left|center|right",
"valign":"top|middle|bottom","max_lines":1,"min_size":8,"max_size":96,"fit":"shrink"}
size "fit" (or fit "shrink") picks the largest size that fits the box: give it flex or w/h.
Text longer than its box is cut with an ellipsis (and warned): raise max_lines to wrap.
{"type":"rect","fill":colour,"outline":colour} (a bar or rule: {"type":"rect","h":2,"fill":"black"})
{"type":"progress","value":0.0-1.0,"h":8}
{"type":"spacer"} (give it flex or w/h)
Colours: black, white, red, yellow, gray, dark_gray, light_gray or #rrggbb (snapped to the profile).
Limits: 8 levels deep, 120 nodes.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| root | Yes | ||
| label | Yes | ||
| profile | Yes | ||
| background | No | white | |
| description | No |