Forum Academy Marketplace Showcase Pricing Features

Change style on conditional

Isn’t there any command to change an ellement’s style programmatically? I mean to apply another named style, not some specific style-related property

I would like to do this in a conditional, say set the button’s style to the style button_hover (that may itself be defining multiple properties).

1 Like

No, the way it works is that the style can have some conditions instead.

1 Like

how can a generic style have conditionals like these that depend on the Type of a ParentGroup?

2 Likes

No, styles can only have ‘basic’ states, like hover, pressed, etc (like CSS), but you can add a condition to an element that has a style applied to it.

another problem is a I have 5 buttons there and want to copy those conditionals. If a Style can have such kinds of conditionals I could avoid typing in that stuff again.

If it doesn’t, consider adding a way to change the element Style programmatically, this is not only useful for conditionals, but obviously in other cases too

also, if only I had copy-paste for the conditionals there (each one and all of them together), I could paste them to the other buttons…

Right click on the button and check the options… https://bubble.io/reference#Interface.Menu.Copy conditional formatting

aha, I was trying to right click in the conditionals tab and also since there were some actions available above each conditional I expected to find a copy there. Consider added such actions there too

I like it how it adapts the expressions automatically when I paste (since I refer to the ParentGroup’s “Thing”)

if you could add “copy” next to “move up/down” and “remove condition” it would be nice and add a Paste at the bottom maybe next to “Define another condition”. E.g. when I want to check “is empty” and also “is not empty” triggers (say to show/hide stuff) there, it is time consuming to select the same stuff again, whereas I could copy/paste and change is empty to is not empty

@emmanuel do you think we can have a button to duplicate a specific conditional formatting in the same element? Beats setting up similar conditions one at a time. This we can duplicate and just change the property value accordingly.