Change HTML button dynamically

I want to change the color and text of my html element(typically a button) based on the database value received. Its a time series API and keeps sending the data continuously. Based on the value received, if value goes above +5%, button should change to red, within the range +1%to+5%, it should remain yellow and normal should remain green.  How can i achieve it.
1 answers

Multiple ways of doing this, for example:

  1. You can use conditional visibility to show a different container with a different class on the element base on the value of the attribute
  2. You can use the css selector helper widget to set a class based on the attribute:
  3. You can use the css class switcher: to set a class based on a microflow