Inspector Input
Every numeric field on an AutoLayout component — Width, Height, Min/Max, Padding, Margin, Gap, WrapGap, ColumnGap, RowGap, and Grid track templates — accepts a unit suffix, a math expression, or a mode name. The field parses what you type and switches modes for you.
Type a unit — the mode flips
Append a unit suffix and the mode dropdown updates automatically. Type a mode name on its own to switch mode while keeping the current value.
| Type this | Mode | Resolves to |
|---|---|---|
120px | Pixels | 120 pixels |
50% | Percentage | 50 % of parent |
1.5x | AspectRatio | width × 1.5 (or height × 1.5) |
fill or 1f | Fill | 1 weight unit of remaining parent space |
hug | Hug | wrap children + padding |
ts or textsize | TextSize | intrinsic TMP bounds |
Typing a unit switches mode in one keystroke sequence: 120px into a Hug field → Pixels 120; hug into a 200px field → Hug (the old 200 is dropped). Casing is ignored, and each mode has short aliases:
| Canonical | Also accepted |
|---|---|
hug | h |
fill | f, * |
ts (TextSize) | t, textsize |
auto (gap distribution) | sb, spread |
even (gap distribution) | sa, rnd |
Math expressions
Anything you’d type into a calculator works in a numeric field: + − * / and parentheses. A unit suffix can follow the expression, and the result switches the field to that mode.
| Type this | Result |
|---|---|
1920/3 | 640 |
(16+8)*2 | 48 |
100*1.5 | 150 |
100+50px | 150 px (Pixels) |
(100/3)% | 33.33 % (Percentage) |
The evaluator runs System.Data.DataTable.Compute — SQL expression rules, . decimal separator.
Gap distribution modes
Gap and WrapGap accept two distribution modes on top of pixels/percentages. Both ignore the numeric value and share out the parent’s free space.
| Type this | Effect |
|---|---|
auto, sb, spread | Space-between — equal gap between children, none at the ends |
even, sa, rnd | Space-around — equal gap before, between, and after children |
Simple numbers apply live (every keystroke rebuilds); units, operators, and parentheses wait for Enter or focus-out so a partial expression like 100+ isn’t evaluated mid-type.
Related
- Sizing → Sizing modes — the six modes and what each resolves to
- Padding · Margin · Row & Column → Gap — pixel and percentage variants
- Grid → Track sizes — track templates accept the same syntax (e.g.
1fr 200px repeat(3, 1fr)) - Overview — full per-property reference