Bubble.io Custom States and URL Parameters: Advanced State Management
When to use Bubble.io custom states, URL parameters or the database: how each works, practical patterns for tabs, filters and wizards, and security tips.
On this page
Every interactive app needs to remember things temporarily: which tab is open, which filter is applied, which step of a wizard the user is on. In Bubble.io you have three places to keep that information: custom states, URL parameters and the database. Choosing the right one makes apps faster, simpler and more pleasant to use. This guide explains each and when to use it.
Three places to keep state
| Custom state | URL parameter | Database | |
|---|---|---|---|
| Where it lives | The browser, on an element or page | The page address | Bubble.io’s server |
| Survives refresh | No | Yes | Yes |
| Shareable as a link | No | Yes | Only via a link to the record |
| Server cost | None | None | Database writes and searches |
| Best for | Temporary interface state | Navigable, bookmarkable state | Anything that must be kept |
Custom states
A custom state is defined on an element or page with a type, such as text, number, yes/no or a data type, and can hold a single value or a list. The Set state action changes it, and elements read it in conditions and data sources. Typical uses:
- Showing and hiding groups, such as tabs or expandable panels
- Multi-step forms, holding the current step and entered values until the final save
- Temporary selections, such as items chosen before confirming
- Interface toggles, such as grid or list view
URL parameters
URL parameters keep state in the page address, such as ?tab=billing or ?q=invoice. Pages read them with Get data from page URL, and navigation actions can set them. Use them when the state should:
- Survive a refresh, so users do not lose their place
- Be shareable, so a colleague opens the same filtered view
- Work with the browser’s back button, like normal websites
Practical patterns
- Tabs: a URL parameter for the active tab, so links can open a specific tab
- Filters and search: URL parameters for shareable views, feeding search constraints; see repeating groups
- Wizards: custom states for steps and values, with one database save at the end
- Selected record: pass the record in the URL or as page data, so the view can be bookmarked
Security and performance
Never trust state for permissions. Users can change URL parameters and inspect browser state. Protect data with privacy rules and workflow conditions, not with what the interface happens to show.
Keeping temporary state in custom states rather than writing it to the database avoids unnecessary server work; see workload units explained and performance patterns.
Frequently asked questions
What is a custom state in Bubble.io?
A custom state is a temporary value stored on an element or page in the user's browser, such as the selected tab or a filter. It is not saved to the database and resets when the page reloads.
When should I use URL parameters instead of custom states?
Use URL parameters when the state should survive a page refresh, be shareable as a link or work with the browser's back button, such as the current tab, a search term or a selected record.
Are custom states and URL parameters secure?
They are fine for interface state, but users can see and change URL parameters, so never rely on them for access control. Always enforce permissions with privacy rules and workflow conditions.
Do custom states use workload units?
Custom states live in the browser, so changing them does not run server workflows or database writes. They are an efficient way to manage temporary interface state.
Can custom states hold lists?
Yes. Custom states can hold a single value or a list of any type, which is useful for temporary selections such as items in a basket before checkout or chosen filters.
Want an app that feels fast and intuitive?
Book a free Idea Audit. We design state, navigation and data flow for speed and clarity.
Other posts
Ready to build your product?
Book a free 30-minute call, or hire a certified Bubble.io developer.
Book a free callHire a Bubble developer