Use Svelte components anywhere HTML is accepted.
This Vite plugin lets you define custom elements right inside your Svelte componentsโjust add an annotation, and you're ready to embed them in any environment, from static HTML to legacy backends or CMS platforms.
No boilerplate. No runtime shenanigans. Just Svelte, anywhere.
<!-- @custom-element my-counter shadow="open" template="lazy" -->
<script>
let { count = 0 } = $props();
</script>
<button onclick={() => count++}>
Clicked {count} times
</button>
Now just use it anywhere:
<my-counter count="5"></my-counter>