Ultimate Guide to Building Web Components with Svelte
summary
Svelte can compile components into standards-based custom elements by enabling customElement: true, but HTML attributes arrive as strings so numeric props break unless converted with props converters via svelte:options; dispatching uses host.dispatchEvent and lifecycle quirks require a wrapper that mounts the inner Svelte component. At Line the approach shares UI across products (150 million MAU). Building from scratch is required because SvelteKit package mode skips compilation, so an alpha toolkit exists — svelte-components template and a TypeScript rollup plugin that infers props — and experimental SSR via element renderer registry is prototype-grade, not production-ready.
AI-written summary · about
