Svelte and SvelteKit 5 · Runes (reactivity)
Component skeleton
A single-file component with state, markup and scoped styles.
<script lang="ts">
let count = $state(0);
</script>
<button onclick={() => count++}>
Clicked {count} times
</button>
<style>
button { font-weight: bold; }
</style>
Official Svelte and SvelteKit 5 documentation
More runes (reactivity) commands
- Reactive state
- Derived values
- Side effects
- Receive props
- Allow two-way binding of a prop
- Share state between components
All runes (reactivity) commands · Svelte and SvelteKit 5 cheatsheet