Button Style with conditions

Hi, does anyone know if it is possible to assign a different style to a button depending on a condition? Ex: If an answer is correct I want a button to turn green and if it is not correct, to turn red.
Thanks!

Assuming you are talking about Apps and not Pages…

The most straightforward way to do this is with two separate buttons with different Moods.

The button is green when the mood is Success and red when the mood is Danger.

Then you can use the visibility condition to control when each button shows based on if the answer is correct or not.

2 Likes

Thanks! But in this case I cannot do that because I have 4 buttons, that correspond to different answers to a question, and I need to change only the color of the correct answer. The problem is the correct answer is not always in the same position…

Does it need to be a button? Not sure how the data is set up, but might be possible to use an inline list > tiles > background color is conditional of whether it’s right or wrong.

If not, you can use buttons, but you’ll instead have 8…one of each red/green. Then add visibility conditions to show the correct color based on the answer.

Inline list is the way to go. I did this recently for an app that had a small quiz included.

2 Likes

Thanks Robert! That looks very good!