Svelte Playground
Write Svelte components and see them live in a sandboxed preview, with compiler warnings, extra files and a zip download.
Compiler warnings, console.log messages and errors appear here.
Shortcuts: Ctrl+Enter run · / search (use ⌘ on Mac)
Free Online Svelte Playground
Try Svelte components live. Write a component in App.svelte, and the preview shows it as you type, with the compiler's warnings and your console messages under it. Add more components, download the project as one zip, and nothing you write is uploaded. Use it to try a Svelte 5 idea, check how runes behave or share a small component without creating a project.
How to use the Svelte playground
- Edit App.svelte. A component has a
<script>block, markup and an optional<style>block. - Watch the preview update. Compiler warnings (many are accessibility tips),
console.logmessages and errors appear under it. - Press + to add a component such as
Greeting.svelteand use it withimport Greeting from './Greeting.svelte'. - Keep shared state in a file that ends in
.svelte.jsand import it wherever you need it. - Open the ⋯ menu and choose Download all files (.zip) to take the project with you.
What is and is not included
You get Svelte 5 with runes ($state, $derived, $props), each blocks, if blocks, events and scoped styles. Packages need Add packages (downloaded from esm.sh only when you press Add); a router and SvelteKit are not available. For plain pages without a framework use the HTML/CSS/JS Playground, and to check your markup try the HTML Beautifier.
Worked example
The sample is a counter, a list and a small child component. The top of App.svelte:
<script>
import Greeting from './Greeting.svelte';
let count = $state(0);
let doubled = $derived(count * 2);
let fruits = $state(['Apple', 'Banana', 'Cherry']);
</script>
<main>
<Greeting name="Svelte" />
<button onclick={() => count++}>Clicked {count} times (double: {doubled})</button>
<ul>
{#each fruits as fruit (fruit)}
<li>{fruit}</li>
{/each}
</ul>
<button onclick={() => fruits.push('Fruit ' + (fruits.length + 1))}>Add a fruit</button>
</main>
Result: a card with the heading Hello, Svelte! (from Greeting.svelte), a button that counts clicks and shows the doubled value, and a fruit list you can add to.
Common mistakes
- Writing Svelte 4 style code such as
export let nameoron:click: this playground uses Svelte 5, so use$props()andonclick. - Leaving an
{#if}or{#each}block unclosed: the compiler error names the file and line. - Importing a package before adding it: press Add packages first.
- Ignoring accessibility warnings: they point at real problems for keyboard and screen reader users.