Forum Documentation Showcase Pricing Learn more

[New Feature] Option sets

Hello everyone!

We’ve just released a new feature: Option sets. Option sets allow you to have a static list of choices or Options which are global to your app. This is great for situations where you know ahead of time what options are possible for a variable - things like days of the week, marital status, team name for a given user, etc. You can create them in the Data tab, add various options to them, and even add attributes to your options. You can use option sets anywhere you would use a normal custom type: as a field on a thing, as a type of a repeating group, etc. They are especially useful for dropdowns, but can have a wide variety of uses all around your application, by both speeding up existing functionality and helping with readability and good practices.

Overview / Tutorial

There is a new tab in the Data section, titled Option sets. In there, you can create, update, and delete option sets, like you would for regular custom types.

Once created, you can add attributes to your options. Attributes are like fields for on your custom types; they have a type and a name, and from each option you can access its attributes. There is an attribute common to all option sets: the Display attribute. This gets the name of your option, and is especially useful for displaying options inside of dropdowns.

Next, you can add options to your sets. Each option is created by typing its Display in, and clicking the “Add option” button. Once created, you can click on “modify attributes” to modify any of the additional attributes you created for your options.

There are a couple of ways to actually use your options. The first is a new global data source, titled Get an option. This allows you, from anywhere in your app, to access any option on one of your option sets. You can also access the special “All options” selection to get a list of all options. Once you have the option you want, you can access its attributes or its display value.

In addition, Bubble is smart about suggesting options. If the field you are filling in requires an option, it will move all of the options to the top of the dropdown; likewise, if the field requires a list of options (like in a dropdown), it will push the “All ” selection to the top.

Comparison vs. Custom types

If you are currently using custom types to achieve a similar result to option sets, you should consider switching your app over for a couple of reasons:

  • Options are faster to access, as they require no database reads
  • Options sets are easily extensible to add new options and change existing ones. Renaming an option will propagate throughout your app.
  • Options sets are easier to use. They can be accessed from anywhere in your app, and are a lot easier to access than doing a search.

However, there are a couple of downsides compared to custom types.

  • There are no privacy settings for options. So, do not put sensitive data as an option’s display or one of its attributes.
  • To add new options or change existing ones, you must push a new version of an app, unlike regular data which you can add while your app is live.

Enjoy the new feature! I hope it helps with your app development. As always, please feel free to ask questions, and if you encounter a bug please file a bug report.

63 Likes

Great stuff, a very useful feature and perfect timing as was just in the process of creating something as a data type even though it was static (menu tabs), read my mind.

Sounds useful that the performance is much faster, as doing the ‘Do a search for’ on static data was a bit sluggish for something with a small data set.

Cheers

6 Likes

That’s great, thanks !
We’ll be able to get rid of these kind of ‘state tables’ :slight_smile:

4 Likes

This is great. A lot of beginner users have a hard time understanding how to create options with Custom Types and/or they think that the “list” attribute for a field is somehow related to a list of options. This makes things so much easier to set up.

Thank you!! :raised_hands:

15 Likes

Fantastic :slight_smile:
no more year\month\day tables :sunglasses:

9 Likes

Wooo. Awesome features coming all the time it seems.

So useful to have enumerations.

7 Likes

:astonished:

:grin::grin::grin::grin::grin::grin::grin:

1 Like

Hooray! Good one, Bubble team!

3 Likes

Thanks all the team!!! It’s awesome!!!

1 Like

@cal thanks again.
Would there be any chance to have the ‘:sorted’ modifier available?

Also would it be possible to move the required field ‘Display’ higher in the list, rather than below the constraining expressions:
image
Just to stand out more and simply more convenient to click and use.

Also just to be picky, could it be 's Display (capital D) :wink:

Cheers

5 Likes

@cal

Thank you and the team for the amazing feature. A couple of things I have questions or suggestions

:pray: Can we have some kind of indicator on the Data types when referencing the option sets? This way we know they are option sets and not a defined data type. This will minimize confusion in complex apps.

:beetle: Deleted attributes still appear when editing an option

:pray: Can we also have a sorted option
image

Thank you again

6 Likes

Ok, I was browsing on my phone earlier when I saw this. Now I’ve had a chance to play and this is AMAZING!

This enables a much cleaner database without needing to create custom types simply to have attributes available on the dropdown value…

And no more going back into the comments to determine exactly which options that text field can accept for a status…

And conditionals update automatically if you change the display value…

Quick question @cal, does this store as a text field on the record? For example, say I’m using this as a status on my user object and have two statuses’ - Active, Inactive. If I download a list of users as a CSV, will the status field download as the Display text (Active or Inactive) or will it still show an ID as it does with a link to a custom type?

3 Likes

@cal here’s a short question: Is there a limit to adding options? As such, the maximum number of options is 100. For example, if I want to submit a list, such as “select your country,” will I encounter an obstacle?

The data is stored as text in the database. When you export or import, it will be based off the display value for your options. So, in your case, it would be “Active” and “Inactive”

3 Likes

There is no limit in place for number of options at this moment, although the interface isn’t really designed for hundreds of them (it can still work, will just be a long list).

2 Likes

Then I’d like to request two improvements.

  1. Install option with CSV
  2. Change in interface.

ice_screenshot_20191220-211232

Thank you again!

1 Like

Will be a game changer to deal with dropdowns on multilingual websites!
Thanks a lot.

2 Likes

Is there a demo environment where we can check the examples?

Our prayers have been heard @Kfawcett, @jamesbond, @keith, @JonL :heart:

THAAAANK YOOOOUUOUOUUUO!

7 Likes

@zelus_pudding, I had forgotten about that thread, but yeah, this feature can be used in a lot of great ways. (Like Faye’s desire for custom colors.)

1 Like