> For the complete documentation index, see [llms.txt](https://docs.flatredball.com/gum/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.flatredball.com/gum/gum-tool/gum-elements/container/wraps-children.md).

# Wraps Children

The *Wraps Children* property controls whether children wrap or stack beyond their container's boundaries when the container's [Children Layout](https://docs.flatredball.com/gum/gum-tool/gum-elements/container/children-layout.md) is set to Top to Bottom Stack or Left to Right Stack.

![Wraps children makes children wrap when using either Top to Bottom Stack or Left to Right Stack.](https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-449f8286433a8d94fb0da5c84a843a3c128793cc%2F04_19%2058%2031.gif?alt=media\&token=b6103f0b-ae61-4b52-a0cc-9fe70eed4cf3)

If a parent has Wraps children set to true, the wrapping adjusts in response to resizing the parent.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-ec52e9e0228ddb86220bd2a2f2442257a0103387%2F04_20%2002%2033.gif?alt=media&amp;token=a4a402ef-5ee9-4330-92de-420c4afad933" alt=""><figcaption><p>Resizing a parent can change wrapping</p></figcaption></figure>

Similarly, resizing a child may result in the stacking changing.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-5027241022d56412c8d7cefb2c66ef30c1e1220e%2F04_20%2005%2040.gif?alt=media&amp;token=75c4bf15-3a4a-4bb5-8b7b-39177043922c" alt=""><figcaption><p>Resizing children can change wrapping</p></figcaption></figure>

The row height in a Left to Right Stack is determined by the largest child in the row.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-32e36ddfdab983c0f4acd599fbab0a996f82b5cf%2F04_20%2007%2048.gif?alt=media&amp;token=8231602b-58d7-47e6-978f-2d9fe4608578" alt=""><figcaption><p>Height of each item in the row determines row height</p></figcaption></figure>

Similarly, column width in a Top to bottom Stack is determined by the largest child in the column.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-9643306bf870e4492b1cd8199ced479327bbf02b%2F04_20%2009%2032.gif?alt=media&amp;token=32a84309-3f0b-45b1-a851-ed872899dbb4" alt=""><figcaption><p>Width of each item in the column determines column width</p></figcaption></figure>

## Positioning Children Within a Row or Column

In a wrapping stack, each row (in a `Left to Right Stack`) or column (in a `Top to Bottom Stack`) acts as the parent of its children on the other axis. A child's `Y Units` and `Y Origin` in a `Left to Right Stack`, or its `X Units` and `X Origin` in a `Top to Bottom Stack`, position it within its row or column instead of within the whole container:

* `Pixels From Center` with a `Center` origin centers the child in its row or column.
* `Pixels From Bottom` (or `Pixels From Right`) with a `Bottom` (or `Right`) origin aligns the child to the far edge of its row or column. `Pixels From Baseline` uses the bottom of the row.
* `Percentage` places the child at a percentage of its row or column's size.
* `Pixels From Top` (or `Pixels From Left`) places the child relative to the start of its row or column.

A row or column is as large as its largest child, and rows and columns stay packed at the start of the container. They do not stretch to fill extra space. Because of this, a child alone in its row is the same size as its row, so centering it or aligning it to the far edge leaves it at the start of the row.

A row counts each child the same way a container with `Height Units` of `Relative to Children` does (see [Ignored Width Values](https://docs.flatredball.com/gum/gum-tool/gum-elements/general-properties/width-units.md#ignored-width-values)):

* An `X` or `Y` value counts from the edge it is measured from. For example, a child placed 10 pixels up from the bottom of its row makes the row 10 pixels taller than the child.
* A portion of a child placed outside its row does not make the row larger.
* A child positioned with `Percentage` does not count toward its row's size.
* A child whose size depends on its parent, such as `Percentage of Parent`, counts toward its row's size when the container's own size on that axis does not depend on its children. For example, in a `Left to Right Stack` that is `300` tall, tiles with `Height Units` of `Percentage of Parent` and `Height` of `30` make each row `90` tall. If the container's `Height Units` is `Relative to Children`, such a child does not count, because the container and the child would each depend on the other.

Size units are unaffected. A child with `Height Units` of `Percentage of Parent` or `Relative to Parent` still sizes itself from the whole container, not its row.

Stacks that do not wrap position children on the other axis within the whole container.

{% hint style="warning" %}
**Breaking change in November 2026:** Before this version, a child in a wrapping stack was positioned within the whole container on the other axis, so a centered child was centered in the container rather than in its row or column. Available in November 2026, or now if building Gum from source. For more information see [Migrating to 2026 November](https://docs.flatredball.com/gum/gum-tool/upgrading/migrating-to-2026-november.md).
{% endhint %}

## Wraps Children and Width Units

Wrapping of children can only be performed if the parent's size does not depend on its children (see more info below). If the parent's size does depend on its children, then the parent will expand to fit is children so wrapping will not occur.

If a parent container's Width Units is set to Relative to Children, then it adjusts in response to children size and positioning, so wrapping will not occur.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-374297df628cd911132d349483c1b984e443eac8%2F18_05%2054%2032.gif?alt=media&amp;token=9e77a386-fb15-4044-aa6e-1d5d8eb70602" alt=""><figcaption><p>Stacking cannot occur if the parent uses a Width Units of Relative To Children</p></figcaption></figure>

A parent can use the following `Width Units` and `Height Units` with children wrapping:

* ✅Absolute
* ✅Percentage of Parent
* ✅Ratio of Parent
* ✅Percentage of Width/Height
* ✅Absolute Multiplied by Font Scale

A parent does not wrap its children if it uses:

* ❌Relative to Children (see below)

Note that Relative to Children can be used on the non-stacking axis. For example, if a parent uses `Left to Right Stack`, then it can still have its `Height Units` set to `Relative to Children`.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-34be61df484fcb5dc0d0579a4ed26c94982b077e%2F18_05%2058%2033.gif?alt=media&amp;token=d9c76392-b47c-444b-9b4b-51320421b835" alt=""><figcaption><p>Left to Right Stack with Height Units set to Relative to Children</p></figcaption></figure>

## Relative to Children and Max Width and Max Height

If a container has a non-null Max Width, then it will expand according to its children until it reaches its max width. Once it reaches a max width, it wraps its children.

The max width applies after the container's `Width` padding is added, so the padding can shrink when the children fill a row. Rows do not wrap earlier to keep the padding.

The container is as wide as its widest row. Each row breaks where the next child would pass the max width, so a later row can be wider than the first. For example, with a `Max Width` of `200`, children `100`, `120`, and `60` wide make two rows, the first holding the `100` wide child and the second holding the other two, and the container is `180` wide.

{% hint style="warning" %}
**Breaking change in November 2026:** Before this version, the container measured only its first row, so later rows wrapped against that narrower width and a wider child could extend past the container. Available in November 2026, or now if building Gum from source. For more information see [Migrating to 2026 November](https://docs.flatredball.com/gum/gum-tool/upgrading/migrating-to-2026-november.md).
{% endhint %}

The following animation shows a container which has:

* Width Units of Relative to Children
* Max Width of 400
* Children Layout of Left to Right Stack
* Wraps Children set to True

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2Fgit-blob-6361f5a66760abd157044a084bc49a9cf76d8e3e%2F16_09%2021%2011.gif?alt=media" alt=""><figcaption><p>Wraps Children allowed when max width is set</p></figcaption></figure>


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.flatredball.com/gum/gum-tool/gum-elements/container/wraps-children.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
