diff --git a/docs/guide/packages/lucide-svelte.md b/docs/guide/packages/lucide-svelte.md index 77e07ea6b..77877ea20 100644 --- a/docs/guide/packages/lucide-svelte.md +++ b/docs/guide/packages/lucide-svelte.md @@ -87,54 +87,95 @@ The package includes type definitions for all icons. This is useful if you want ### TypeScript Example +#### Svelte 4 + ```svelte {#each menuItems as item} - - - {item.name} - + + + {item.name} + +{/each} +``` + + +#### Svelte 5 +Some changes are required since Svelte 5 [deprecates](https://svelte.dev/docs/svelte/v5-migration-guide#Components-are-no-longer-classes-Component-typing-changes) the `ComponentType` typescript type. + +```svelte + + +{#each menuItems as item} + {@const Icon = item.icon} + + + {item.name} + {/each} ``` ### JSDoc Example +#### Svelte 4 + ```svelte + +{#each menuItems as item} + + + {item.name} + +{/each} +``` + + +#### Svelte 5 + +```svelte + + +{#each menuItems as item} + {@const Icon = item.icon} + + + {item.name} + +{/each} + ``` For more details about typing the `svelte:component` directive, see the [Svelte documentation](https://svelte.dev/docs/typescript#types-componenttype). @@ -197,13 +289,28 @@ The example below imports all ES Modules, so exercise caution when using it. Imp ### Icon Component Example +#### Svelte 4 + ```svelte - + +``` + +#### Svelte 5 + +```svelte + + + ``` #### Using the Icon Component