Conditional component possible?

I guess I know already the answer but just want to double check if there might have been some workaround for the following:
In a custom widget (oh-list element) I have a few labels as a group headline (Basement, 1st Floor, 2nd floor,…) and per group a diffeent amount of TRV items like this:

Ground Floor
1st Floor

Ideally, I want to provide Level labels and TRV items via props (comma seperated string) or as an array in the repeater 's source.
In any case I come to the point where I need to do be able to place a Label or an oh-slider-item component based on a condition
Does anybody has an idea?

In the newest versions, the component now accepts expressions. Just make sure the result of the expression is a string of the component name.

Key values that are not relevant for the component will simply be ignored, so slider specific properties won’t impact the label.

you mean

- component: =(r.loop="whatever"?"Label":"oh-slider")

And I need to throw all required Label and oh-slider properties into this component and depending on the condition result the non-applicable attributes are ignored?


Of course, your test expression needs == instead of just =.

1 Like

Justin, does that relate to future versions or to 3.4 Milestone releases?
I have checked all Milestone release notes but could not find anyinformation.
I am running v3.4M6

It was another piece of the same advanced widget PR that added the @ and @@

So any version since October should have this capability.

1 Like