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
- Component skeleton
- Reactive state
- Derived values
- Side effects
- Allow two-way binding of a prop
- Share state between components
All runes (reactivity) commands · Svelte and SvelteKit 5 cheatsheet