Paper’s layout engine is based on Morphorm, a flex-like system built around rows and columns. Each element declares how large it wants to be and how it should be positioned, and the engine resolves the whole tree in a single pass from root to leaves. This page covers every knob you can turn.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/ProwlEngine/Prowl.Paper/llms.txt
Use this file to discover all available pages before exploring further.
LayoutType: Row vs. Column
Every element has aLayoutType that controls how its children are arranged. LayoutType.Row places children left-to-right; LayoutType.Column stacks them top-to-bottom.
LayoutType.Column.
PositionType: Normal Flow vs. Absolute
PositionType controls whether an element participates in its parent’s flow.
| Value | CSS equivalent | Behaviour |
|---|---|---|
ParentDirected | position: relative | Default. The element takes up space in the parent’s main axis and is placed by the layout engine. |
SelfDirected | position: absolute | The element is positioned relative to its parent using its own Left/Top/Right/Bottom values and does not push siblings. |
Sizing: Width, Height, and Constraints
Set an element’s size withWidth(UnitValue) and Height(UnitValue), or both at once with Size(UnitValue). Any UnitValue type is valid — pixels, percentage, stretch, or auto.
MinWidth, MaxWidth, MinHeight, MaxHeight, Width, Height.
Margin: Child-Side Spacing
Margin (and its individual-side variants Left, Right, Top, Bottom) is set on a child element and controls the space around it on each side. The default value for every margin side is UnitValue.Auto, which tells the parent’s ChildLeft/ChildRight/ChildTop/ChildBottom defaults to fill in.
Stretch values, which lets a margin compete with sibling sizes for leftover space — useful for pushing an element to one side.
Padding: Parent-Side Inset
Padding is set on the parent and defines a guaranteed inset on each side of the parent’s content area. Children are placed within the padded area; stretch competition only consumes the remaining inner space.
Child Alignment: ChildLeft, ChildRight, ChildTop, ChildBottom
These properties are set on the parent and act as defaults for any child whose corresponding margin side is still Auto. By placing Stretch values into these slots you can replicate CSS justify-content alignment — the engine grows the stretch slots to consume leftover space.
| Desired alignment | Recipe (set on parent) |
|---|---|
| Pack at start (default) | No extra settings needed |
| Pack at end | .ChildLeft() (row) or .ChildTop() (column) |
| Center | .ChildLeft().ChildRight() (row) or .ChildTop().ChildBottom() (column) |
| Space between | .ColBetween() (row) or .RowBetween() (column) |
| Space around | .ChildLeft().ChildRight().ColBetween() |
UnitValue.StretchOne:
Gap Between Children: RowBetween and ColBetween
ColBetween inserts default spacing between adjacent children in a Row container (between columns). RowBetween does the same for a Column container (between rows). The gap is only applied when both adjacent margin sides are still Auto.
Aspect Ratio
AspectRatio(float ratio) locks the element’s width-to-height ratio. The engine uses the more constrained axis to derive the other:
ContentSizer for Custom Auto-Sizing
When an element’s size isAuto, Paper calls its ContentSizer function — if one is set — to measure the preferred size. The function receives optional maximum constraints and returns (width, height)? (return null if the element cannot be measured at those constraints).
Clamp to Screen
ClampToScreen() ensures an element never overflows the viewport bounds after layout. It is applied as a post-layout position correction, so it works with both ParentDirected and SelfDirected elements. Children move with the parent automatically.
Layout Recipes
The examples below combine the primitives above into common real-world patterns.Layout is resolved once per frame inside
EndFrame. All element declarations made between BeginFrame and EndFrame feed into a single layout pass — there is no incremental update mechanism.