I am looking to create a multi state indicator that changes background color and font color depending on a state value. I have created a custom property called state and binded it to the tag where I get my integer from 0-4. I have different styles I want to display depending on that integer value. How can I bind styles to the props.styles.classes property, and make it change style class depending on the state value? I just started working with perspective yesterday, so any help would be greatly appreciated. Thanks.
There’s lots of ways to do this. For a simple 1 value → 1 style, you can bind
style.classes to a property binding (to the value) with a transform on it.
If you use an expression transform, you can use a
Or you could use a Map transform, which has some nice helpful UI for setup:
Thank you so much for the quick response. I’m just starting to learn perspective and will make use of this forum for questions!