Svelte and SvelteKit 5 · Runes (reactivity)

Receive props

$props destructures the props a component receives, with defaults.

let { name, greeting = "Hello", onclose }: { name: string; greeting?: string; onclose?: () => void } = $props();

Official Svelte and SvelteKit 5 documentation

More runes (reactivity) commands

All runes (reactivity) commands · Svelte and SvelteKit 5 cheatsheet

Was this page helpful?