Docs

Svelte 5 runes

The core runes you use day to day.

$state

function
let v = $state(initial)

Creates deeply reactive state.

PropTypeRequiredDescription
initialTYesInitial value.

$derived

function
let v = $derived(expr)

A read-only value recomputed from other state.

PropTypeRequiredDescription
exprTYesPure expression.

$effect

function
$effect(() => { ... })

Runs a side effect after the DOM updates; return a cleanup fn.

$props

function
let { a, b } = $props()

Reads the component props.

$bindable

function
let { v = $bindable(d) } = $props()

Marks a prop as two-way bindable.

PropTypeRequiredDescription
dTDefault value.