Is there a way to access component properties as dynamic data?

I’ve got a component where I want the background color to change based on the results of an ACF select field - but the component will be used for multiple, different fields.

So I need to:

  1. specify the field name to use in the property, then
  2. use that field name to retrieve the background color.

For example, say that I’ve got an ACF field called “goals” and another called “budget”.

I create the component.

I type “goals” in one of the properties fields.

Based on that, the component uses the value of the field to add color to the background.

Any ideas how to achieve that?

you can create a select list depends on the css attribute and you can make that as property

background:red
background:black
background:#ccc
…etc
whatever

I made this setup to show or hide but it is still css setup same thing
take a look how it works

new class property is great too you can make custom class setup and then use custom class list as style list and you dont have write any css at all as well when you use custom classes.