DEV Community

Discussion on: How to Create a Web Component in Svelte

Collapse
 
silvio profile image
sil-vio

Hi bemisawa! yes it's possible to pass html to web components

For example if your web components is:

<div>
  <slot />
  <span>
    <slot name="secondslot"></slot>
  </span>
</div>
Enter fullscreen mode Exit fullscreen mode

you can use this way :

<my-component>
 default slot.
 <small slot="secondslot">second slot</small>
</my-componentn>
Enter fullscreen mode Exit fullscreen mode