Did you know that you can use Option Sets to save time when creating your Bubble application?
In this short Bubble tutorial, we will learn what option sets are and how to start using them in your application.
What are Option Sets
Option sets are a static list of global choices for your Bubble.io app. You have to define them once and use them wherever you need a custom data type.
They are similar to Data types, but they load faster. Option sets can be used with drop-downs and radio buttons. You can also use them to create a menu for your Bubble app.
You might have a drop-down with a list of static items. If you ever wanted to change the list of options, you would have to modify the choice options for all the drop-downs individually.
Create a new Option Set in Bubble
To set them up, go over to the Data tab on the left and select Option sets.
Your Option Sets will not look like this. They'll be empty.
You can click on 'New option set' to create one.
Once you create an Option set, you can start defining the Options.
You can add, for example, a list of Categories a product can have if you are selling clothes. This Option set can then be used as the chosen source for a dropdown that you show to users. We'll talk about that later.
Option sets have 'attributes' which are additional values that you associate with each option.
For example, you can set a price slab with each product category. To do so, add a new 'attribute', and when you add a new Option, you can define the attribute.
So, when you add an option with the Display attribute as Shoes, you can also set the Price attribute as $10. This will allow you to use the Price attribute wherever you're using the Options set.
How to use Option sets in Bubble
Option sets will help you create a well-organised Bubble application. You can use Option sets to display a static list in your Bubble.io app.
An everyday use case is to use them as the Data source in your input elements. They are similar to Data types, but they load faster.
Use Option sets in dropdowns
Select the Choice style as Dynamic and Type of Choices as the name of the Option set that you created. The choice source will All Option sets name. The Option Caption will be the Attribute you want to use in the dropdown.
Use Option sets in radio buttons
Similarly, the Choice style should be dynamic for the radio buttons and the Choice source as All Option sets name.