Are there any examples of using LitRenderer with conditions that result in different elements? Or if it is even possible?
My use case is building an element to display an object that may or may not be navigable. If navigable, then use an anchor with an href attribute. If not navigable, use a span element.
I know how to use conditions inside an element. For example, I tried to use the disabled attribute in the anchor, <a href='${item.href}' ? disabled=${item.disabled}>${item.text}</a>
. Unfortunately, disabled is not a valid attribute of anchor and so disabled is ignored. A shame.
I tried generating the complete html, i.e., something like LitRenderer of("${item.html}").withProperty("html", value -> htmlFor(value))
. But that is interpreted as text, not an element.
I am going to try it with a custom subclass of ComponentRenderer, and that should work. I just wanted to know if there was a simpler approach. Thanks.