Search code examples
javascripthtmlpolymersitecoreinnerhtml

lit-html: how to render contents of .innerHtml


I'm creating a custom component library and using it inc onjuction with a react component library framework called Sitecore jss. I have the following:

<custom-component><Text/></custom-component>

In this instance <Text/> renders as

<span>
   <span>Stuff</span>
</span>

What I'd like to have happen in that the span inside of my custom component gets rendered as html. However, using .innerHtml gives me a string of the html rather than actual html. Is there a way to get lit-html to render innerHtml as html and not as a string?


Solution

  • Turns out I can use the <slot> element instead of .innerHtml in my component.