Custom icons - Svelte Awesome Icons

You can create a custom default icon, by using Icon:

Create a custom component #

Create a Svelte component named src/lib/MyIcon.svelte:

Svelte 4 #

Svelte 5 #

This component, MyIcon.svelte, accepts an icon prop which you can use to pass in the specific icon component you want to display.

Implementation #

To use your custom default icon in a Svelte page, do the following:

Svelte 4 #

Svelte 5 #

Here, we import the MyIcon component and the BandageSolid icon. By passing the BandageSolid icon to the icon prop of MyIcon, you apply the default configuration to the icon.