# 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) 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)

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" 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" 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" 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" alt=""><figcaption><p>Width of each item in the column determines column width</p></figcaption></figure>

## 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" 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" 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 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%2Fu4OA6HHLCU4VoMfq5V5B%2F16_09%2021%2011.gif?alt=media&#x26;token=cddbdc69-341d-4ebe-83c7-3e43b6249150" alt=""><figcaption><p>Wraps Children allowed when max width is set</p></figcaption></figure>
