> 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/stack-spacing.md).

# Stack Spacing

### Introduction

The Stack Spacing variable controls the additional padding between children when a container uses a Children Layout of either Top to Bottom Stack or Left to Right Stack. Stack Spacing serves as an alternative to adjusting the position of each item in a stack.

### Setting Stack Spacing

A larger Stack Spacing value increases the spacing between each child. By default Stack Spacing is set to 0 which means that no spacing is added between items in a stack.

<figure><img src="/files/IVv4l7I7J0r04rFfY5Wl" alt=""><figcaption><p>Stack Spacing of 0 results in no space between children</p></figcaption></figure>

Changing the stack spacing adds gaps between each child as shown in the following animation.

<figure><img src="/files/YNXRaMOyvFJGQk4HZOZj" alt=""><figcaption><p>Stack Spacing used to add gaps between children</p></figcaption></figure>

Stack Spacing can also be a negative value resulting in overlapping children. The items in the following animation are partially transparent to show the overlap.

<figure><img src="/files/CnoEkCuA2E5i5BIyYXXo" alt=""><figcaption><p>Negative stack spacing results in overlaping children</p></figcaption></figure>

### Stack Spacing and Stacking Direction

Stack Spacing can be used for either Top to Bottom or Left to Right Stacking.

<figure><img src="/files/RKtEuNdxU92szry5Jnm0" alt=""><figcaption><p>Stack Spacing can apply spacing vertically or horizontally</p></figcaption></figure>

### Stack Spacing and Wrapping

Stack Spacing can be used on container instances which stack and wrap their children. As stack spacing increases, the amount of space allocated to each object also increases, resulting in wrapping occurring earlier.

If wrapping occurs, then stack spacing applies spacing between rows and columns as shown the following animation:

<figure><img src="/files/sAIgejrwwKeVEIZNKRB3" alt=""><figcaption><p>Increasing Stack Spacing results in spacing between children both vertically and horizontally</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 dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.flatredball.com/gum/gum-tool/gum-elements/container/stack-spacing.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
