svelte-component-import

Svelte Component Import

Import a Svelte Component and Set Component Properties

svelte-component-import

Import a Svelte component and set component properties.

This is an extension of an excellent description provided by Ling Talfi outlining how to consume a bundled Svelte component in a non-Svelte web app.

https://github.com/lingtalfi/TheBar/blob/master/discussions/inject-svelte-in-existing-app.md

I've extended the example by adding a css file for the bundle, and adding the ability to update props of the Svelte component from Javascript.

Note the "<svelte:options accessors/>" Svelte compiler option in the component source file. This is required in order to access properties of the component via javascript in the consumer app.

Top categories

svelte logo

Need a Svelte website built?

Hire a professional Svelte developer today.
Loading Svelte Themes