Each Blocks in Svelte
From the Svelte cheat sheet ยท Control Flow ยท verified Jul 2026
Each Blocks
Rendering lists and arrays
javascript
{#each items as item}
<li>{item.name}</li>
{/each}
{#each items as item, index}
<li>{index + 1}. {item.name}</li>
{/each}
{#each items as item (item.id)}
<li>{item.name}</li>
{/each}๐ {#each} for rendering lists and arrays
๐ (key) for keyed updates and animations
๐ {:else} for empty state handling
โก Efficient list reconciliation with keys