> For the complete documentation index, see [llms.txt](https://bubble.citizendev.io/bubble-convention/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://bubble.citizendev.io/bubble-convention/naming-conventions/element-naming/custom-states.md).

# Custom states

## Naming

To differentiate custom states from data fields and data types, use **snake\_case** for custom states.

## Placement of states

States can be divided into 2 types:

* **Global states**: States that are accessed and used throughout the whole page, or the whole reusable element.
* **Local states**: States that are used only within a group or an element.

Generally, **global states** should obviously be placed in the global element (in a page or in a reusable element). Since states are placed there by default, there is no need to additionally label the page/reusable element.&#x20;

However, placing states in a reusable element exposes the states to other elements in the page to access (not a bug but a feature!). So, if you want to truely encapsulate a reusable element and only expose controllable states to the page, consider placing the other states in the Body or main container of the reusable element.  &#x20;

**Local states** should also be placed in the global element they are not numerous for the ease of access. They should only be placed locally (in the group that wraps the elements that uses those states, or the atomic elements themselves) if they are numerous. In that case, Element naming/Other notation page talks a bit about naming elements that have custom states in them.


---

# 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, and the optional `goal` query parameter:

```
GET https://bubble.citizendev.io/bubble-convention/naming-conventions/element-naming/custom-states.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
