Skip to content
Dashboard

What's new in Svelte 5

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

Copy link to headingRunes

Copy link to headingThe $state, $derived, and $effect runes

Copy 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>

Copy link to headingUniversal reactivity with .svelte.js files

Copy link to headingOther runes

Copy link to headingCompiler improvements

Copy link to headingComponents as functions

Copy link to headingNative TypeScript support

Copy 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}

Copy link to headingVite benefits

Copy 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

Copy link to headingSvelte on Vercel

Copy link to headingGetting started with Svelte

Ready to deploy?