> 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/tutorials-and-examples/working-with-gum/2-variables-tab.md).

# 2 - Variables Tab

## Introduction

The Variables tab displays the variables of the selected instance or element. When a component is selected, the values set in the Variables tab become the defaults that its instances inherit.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FF5MYH2rHe9f29FQ6bbCT%2F13_06_13_11.png?alt=media&amp;token=cdf3e6a5-2360-43b8-9a49-1eb4ce1e3357" alt=""><figcaption><p>Variables tab in Gum</p></figcaption></figure>

### Editing Variables

Variables can be edited by changing the displayed value for a given variable. Once a value is set, you can press Enter, Tab, or click outside of the text box to apply the value.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FLbapCqgoel9yFPAD2PSr%2F13_06_14_58.png?alt=media&amp;token=2b7cf63d-5bc5-4f6b-9990-bec113ab8656" alt=""><figcaption><p>Editing values</p></figcaption></figure>

Numerical values can also be changed by holding down the left mouse button over the variable name and dragging left or right.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FgAPjdIli8qSsorVxq66r%2F13_06_16_32.gif?alt=media&amp;token=09902d1d-a1c7-4fbe-8a6b-05273555e9e8" alt=""><figcaption><p>Dragging over a variable name to change its value</p></figcaption></figure>

Variables which can be edited in the Editor tab also update in real time in the Variables tab.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FtDMjAiriPseSomYCMz9F%2F13_06_22_16.gif?alt=media&amp;token=5faae108-97e4-4c66-a15f-370e83687773" alt=""><figcaption><p>Editing an instance in the Editor tab updates the Variables tab</p></figcaption></figure>

### Default and Overriding Values

Newly-created Gum instances inherit their variable values from their Component or Standard definition. These default values can be changed, resulting in the default value being overwritten.

For example, the ButtonStandard instance you added on the previous page has its X and Y values changed. If you resized the button, then its Width and Height are also set, overwriting their default values.

Variables which overwrite their default have a small box icon next to the label.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FA2YVoz0sYd6phDS5nYUy%2F13_06_25_07.png?alt=media&amp;token=e6335282-164d-4e3c-93d3-85db552ee91a" alt=""><figcaption><p>Values which overwrite their defaults</p></figcaption></figure>

Values can be restored to their default by right-clicking on the variable and selecting **Make Default**.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FEsDCBdwtuuxmk7A8tYDf%2F13_06_26_13.png?alt=media&amp;token=bad68fc5-66e4-4baf-8487-e51e398b2119" alt=""><figcaption><p>Right-click option to make a variable restore its default</p></figcaption></figure>

For more, see [Variables](https://docs.flatredball.com/gum/gum-tool/variables.md#setting-variables-to-default).

Default variables are not just a starting point - they are live references that continue to apply if the base component changes. In other words, if a variable changes on the ButtonStandard component, then these variables automatically update all ButtonStandard instances everywhere, unless the instance explicitly overrides that variable.

To see this in action:

1. Drag two **ButtonStandard** instances onto MainScreen.
2. Select the second instance and set its `Width` to a value larger than the first one's.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FzwrhEytVu9ZRWP7HD4bB%2F13_06_33_14.png?alt=media&amp;token=589c1dbc-80ef-4f5a-a743-ddf85f789cfb" alt=""><figcaption><p>Two ButtonStandard instances, the second with a larger Width</p></figcaption></figure>

The first button keeps the default `Width` of 128, while the second button explicitly sets its own `Width`.

3. Under **Components** > **Controls**, select **ButtonStandard** and set its `Width` to 250.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FRDhzlKjHR0tbXNk2KJfL%2F13_06_35_01.png?alt=media&amp;token=d594d148-1216-4b1e-abb9-09b4db78e89a" alt=""><figcaption><p>ButtonStandard's default value changed</p></figcaption></figure>

Back on MainScreen, the first button is wider because it inherits the default, while the second button has not changed because it sets its own `Width`.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FwQSfAbFw8akZKoYK2Q94%2F13_06_36_06.png?alt=media&amp;token=826a9cf6-2b89-4383-9844-2402df69ef07" alt=""><figcaption><p>Width values after ButtonStandard has changed</p></figcaption></figure>

Note that the Preview window can be pinned on the screen, letting you test how default value changes affect instances in realtime.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2F5ASdDBDHFyl4C0wOQ1Q6%2F13_06_37_49.gif?alt=media&amp;token=226fe99c-60ad-4df5-907d-72795d0c7307" alt=""><figcaption><p>Preview window displaying width changes in real time</p></figcaption></figure>

### Filtering and Collapsing

The Variables tab supports searching for variables by name. This filter persists across selections so you can filter down and hop between different instances when performing similar types of edits.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FDBOzZZMxnK1NcevVWnCn%2F13_10_25_25.png?alt=media&amp;token=6559bf7b-208c-496a-be09-b502df987819" alt=""><figcaption><p>Variables tab displaying the Text variable, filtered by the word "text"</p></figcaption></figure>

For more on filtering, see [Variables](https://docs.flatredball.com/gum/gum-tool/variables.md#filtering-variables).

Similarly, categories can also be collapsed to hide their variables.

<figure><img src="https://2695663588-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-M_fzQmxQ1VeUFHcoo2c%2Fuploads%2FCBoVC1eQzo47vJDCeNdE%2F13_10_26_45.png?alt=media&amp;token=2d95f25c-91e7-44d9-954d-2786a4af436d" alt=""><figcaption><p>Categories collapsed in the Variables tab</p></figcaption></figure>

Note that categories also follow a rainbow color ordering, and the same-named category is always displayed as the same color so it can be found more easily.

Some categories are specific to certain types. For example the Text category appears for Button instances, but it does not appear on the Panel type.

### Conclusion

This page shows how to work with the Variables tab, including working with default and overriding values. The next tutorial introduces parenting, alignment, and stacking layouts.


---

# 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/tutorials-and-examples/working-with-gum/2-variables-tab.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.
