Creating a custom state for multiple objects at a time?


I have a number of objects that have the same parameters when it comes to size and conditions. There are 50 of them on one page.

What I’m trying to do:

I’m setting up a custom state for every one of them. It’s the same state and it will apply to the same changes for every button (color, background) so I can do this more efficiently.

What I would like to do:

Is there a way to do this for more than one button at a time?

What I’ve tried:

Setting up conditions or a custom state using Style, but there are no custom states there.

Hi there,
You can’t dynamically set the design of buttons using Bubble’s styles.
But you can create a reusable element using groups and texts that looks like a button and store how it should look like into you database (eg background color, color when hoover, text, shadow…)

@devease Thanks. Is it possible to set up a custom state using database?

Otherwise, the set up does not have to be dynamic, but maybe faster than setting up a custom state to each button individually if that’s possible?

Another approach (this is the best way I have found to create colour “themes”) is to not use Bubble’s styles but to use dynamic values for the colours. eg

And you can extend that a bit further with putting in HTML with CSS snippets that also reference dynamic values. Hacky I know but it’s the best I approach I could find. I would be interested if someone had some smarter ideas! :slight_smile:

1 Like

@lindsay_knowcode Thanks!

Saving button’s design in the database allows you to display the user’s choice even when they log back or when the page is refreshed.
I made a video of what I had in mind: Custom Reusable Buttons video

1 Like

This topic was automatically closed after 70 days. New replies are no longer allowed.