Skip to content
Dashboard

What's new in Svelte 5

Svelte 5 brings runes for universal reactivity, snippets for reusable markup, and compiler improvements.

Link to headingRunes

Link to headingThe $state, $derived, and $effect runes

Link to headingSignals and fine-grained reactivity

Counter.svelte
<script>
let count = $state(0);
let doubled = $derived(count * 2);
</script>
<button onclick={() => count++}>
Clicks: {count}
</button>
<p>Click doubled: {doubled}</p>

Link to headingUniversal reactivity with .svelte.js files

Link to headingOther runes

Link to headingCompiler improvements

Link to headingComponents as functions

Link to headingNative TypeScript support

Link to headingSnippets

App.svelte
<script>
let items = [
{ id: 1, name: 'Apple', price: 0.5 },
{ id: 2, name: 'Banana', price: 0.25 },
{ id: 3, name: 'Orange', price: 0.75 }
]
</script>
<ul>
{#each items as item}
{@render row(item)}
{/each}
</ul>
{#snippet row(item)}
<li>
<span>{item.name}:</span>
<span>${item.price.toFixed(2)}</span>
</li>
{/snippet}

App.svelte
<script>
import ItemList from './ItemList.svelte';
let items = [
{ id: 1, name: 'Apple', price: 0.5 },
{ id: 2, name: 'Banana', price: 0.25 },
{ id: 3, name: 'Orange', price: 0.75 }
];
</script>
<ItemList {items}>
// Implicitly pass this snippet as a prop.
{#snippet row(item)}
<li>
<span>{item.name}:</span>
<span>${item.price.toFixed(2)}</span>
</li>
{/snippet}
</ItemList>

ItemList.svelte
<script>
let { row, items } = $props()
</script>
{#each items as item}
{@render row(item)}
{/each}

Link to headingVite benefits

Link to headingSvelte's growing community

Svelte has allowed to us to ship quickly and with confidence, helping us keep pace with a dynamic AI ecosystem, despite a minority of the team being frontend developers. Our latest version of Gradio is also built on top of SvelteKit, bringing all of the power and performance of a best-in-class framework to around 1 million developers every month. The future is equally exciting; now that we are using SvelteKit, we can release a whole host of new features that would otherwise be costly to implement and support.
Peter Allen (pngwn) Hugging Face

Link to headingSvelte on Vercel

Link to headingGetting started with Svelte

Ready to deploy?