Querying state in css

Hey guys!

I would like to query certain attributes in the state object from the custom CSS panel. I am passing colours through the state object in my react application through to builder. I would essentially like to change the color of text in the view based on the property passed through.

I am currently able to dynamically set the background colour using the UI on builder.io

an immediate remedy would be if i was able to set text colour dynamically using data binding

Thanks

Yashu

Hi @yashu! Thanks for reaching out.

To change the text color dynamically in Builder using data binding you can enter in “style.color” from “state.somePropertyYouSet” like this:

Builder shows a handful of properties you can choose from (background color, hide if, show if, etc), but you can enter in any property in this section.

I hope this was helpful, if you have any questions don’t hesitate to reach back out :grin: