Using Option sets in dropdown

Database Apr 01, 2021

Option sets are basically a static list of choices that are global to your app. You just have to define them once and use them wherever you need a custom data type.

They behave like a Data type of their own, but are significantly faster to load. You can use Option sets with dropdowns, radio button or even use them to create a menu in your Bubble app.

The most common place where you'd use them is with Dropdowns.

Defining the Option set

Create Option Set in Bubble.io

Creating an Option set is easy. It is quite similar to the way you create a new Data type and its Fields.

To create or view an Option set, go to the Data tab of your applications. Then open the Option sets subtab. You'll be able to see all your Option sets over here and edit them.

To create a new Option set, give it a name and click Create button. For this tutorial, I'll be creating a new Option set called Subscription Plan with 4 choices. Each choice will also store a few attributes (fields).

Create a New Attribute in Bubble.io

An Attribute is similar to a Field in a Data type. You can define an attribute to hold a certain value and use it wherever the Option set is being used. I have added some attributes which I can use later on for custom logic.

For example each Subscription status has an attribute "No of users". I can apply a check on a workflow when they are inviting new users to run the workflow only when Current User's Subscription Status No of Users < Current User's Invited Users.

Using Option sets as choice source in dropdown

Create a Dropdown in Bubble.io

Create a dropdown and change the Choice style to Dynamic. We don't need a static Choice style. The Type of Choice will be the name of the Option set.

Dropdown with Dynamic Data

You now have a dropdown with Dynamic data source and the choices of this dropdown can be conveniently updated from the backend.

The biggest benefit of using Option sets is that they are faster to load as compared to fetching data from Data types. And instead of having to manually update every dropdown whenever you want to change the choice source, you can update them once and all the dropdown will be automatically updated.

How to use Option sets

How to create a dropdown that filters another dropdown


If you need some help with your Bubble app or if you need a team of Bubble developers to build a Bubble app for you, reach out to me at [email protected] You can also follow me on Twitter.


Tags