Skip to content

Sizing

Width and Height are independent — a node can fill horizontally (Width = Fill) while shrinking to its tallest child (Height = Hug). Each axis picks one of six sizing modes, plus a value for some.

The Size row highlighted in the Inspector, with per-axis unit and Min/Max clamps.

Sizing modes

Type the mode name or a unit suffix into the Width/Height field (see Inspector Input):

ModeInspector fieldResolves to
Pixelsa number, e.g. 120The literal pixel value
HughugSum of children + padding
Fillfill (+ weight)Share of parent’s free space, by weight
Percentage50%A percentage (0–100) of parent size
AspectRatioa ratio, e.g. 1.5xwidth × ratio (or height × ratio)
TextSizetsIntrinsic bounds of the element’s TMP text

Pixels

Pixels

Pixels

A literal pixel value, unaffected by parent or children — for fixed-size elements like icons, dividers, sized buttons.

layout.Width = UIDimension.Pixels(120f);
layout.Height = UIDimension.Pixels(40f);

Hug

Hug

Hug

Shrink-wraps to the children's combined size plus the element's own padding. A Hug leaf with no children resolves to its padding alone.

Set Width and Height to Hug (type hug).

For text-only leaves, use TextSize instead.

Fill

Fill

Fill

Shares the parent's remaining space with other Fill siblings, proportional to the weight argument (default 1).

Set Width to Fill (type fill); set a weight for proportional sharing.

Cross-axis: a Width of Fill inside a Column means “fill the column’s full width.”

Percentage

Percentage

Percentage

A fixed fraction of the parent's size on the same axis — independent of siblings.

Set Width to 50%.

Use Fill when siblings should share leftover space; use Percentage when you want a specific fraction independent of siblings.

AspectRatio

AspectRatio

AspectRatio

Locks one axis to a multiple of the other — an AspectRatio of 2 is 'twice as wide as it is tall.'

Set Width Fill and Height to AspectRatio 1 (a square).

Make sure at least one axis has a definite size (Pixels, Fill, Percentage, or Hug-with-content).

TextSize

TextSize

TextSize

Measures the element's TMP text and uses those bounds. Text-only — there's no equivalent for images.

Set Width/Height to TextSize (type ts).

TextSize can apply to both axes or just one — e.g. a full-width label (Width = Fill) that shrinks vertically to its wrapped text (Height = TextSize). If a TextSize element has MaxWidth set, TMP wraps and Height grows to fit.

Cheatsheet

  • I know the exact size → Pixels
  • This element should grow to fit → Hug (children) or TextSize (text)
  • I want it to fill remaining space → Fill
  • I want a specific fraction of parent → Percentage
  • It must keep a width:height ratio → AspectRatio
  • I have a TMP text and want its natural size → TextSize

Min and Max

Every mode can be clamped per-axis:

Min / Max

Min / Max

Clamp any mode per-axis. Bound a Fill so it doesn't collapse below or grow above sensible limits, or give a Hug element a floor.

Set Min Width 120, Max Width 400, and Min Height 40.

MinWidth / MaxWidth / MinHeight / MaxHeight are pure floats in pixels. Use them to bound a Fill so it doesn’t collapse below or grow above sensible limits, or to give a Hug element a sensible floor.

Inspector input

Width and Height inspector fields parse unit suffixes and math — type 120px, 50%, 1.5x, fill, hug, 100+50px, or (1920/3)px and the field switches modes in one shot. See Inspector Input for the full syntax.

  • Inspector Input — type units and math directly into sizing fields
  • Absolute — how Width/Height interact with absolute constraints
  • Row & Column — how Fill/Hug interact inside Row and Column
  • Grid — how track sizing interacts with cell content sizing
  • AutoUI — builder reference
Docs for AutoLayout PRO v1.0.0 Changelog