Can components have states? Is the concept of states part of the platform?
I built my responsive navigation (didn’t use the provided navigation options as I couldn’t make them responsive in the way I needed). I have numerous pages 10+ page types. I’d like to have just 1 component and tell each button to use state A for current page and state B for not current page.
Am I thinking about this correctly?
Any direction is appreciated.
This is a core feature of our upcoming runtime upgrade, which will bring with it both the ability to access composite component root-level properties via formulas, as well as the ability to define parallel component states that have e.g. a few style overrides compared to the base state.
Currently, the only thing accessible is direct component property bindings, so the convoluted way to acheive this is e.g. have in your composite component two containers state A and state B, and then have
state_b_active boolean properties defined for the composite, and then bind those to each container’s Visible property. (Since you can bind only the component property directly, you can’t use a formula like
root.state === "a" for the container visibility yet, but this will be possible.)