Skip to content

Bindings, Actions & Transitions

Connecting components to the DOM and to motion

Section titled “Connecting components to the DOM and to motion”

Runes give you reactive state; this module covers the directives that connect that state to real DOM elements and to visual motion:

  • Bindings (bind:) create a two-way link between state and a DOM property — the input updates the state, and the state updates the input.
  • Actions (use:) run imperative setup code on an element when it mounts — the escape hatch for third-party libraries, focus, tooltips, and click-outside.
  • Transitions & animations (transition:, animate:) declaratively animate elements as they enter, leave, and reorder.
LessonWhat you’ll learn
Bindingsbind:value, bind:this, bind:group, and component bindings
ActionsThe use: directive and the action lifecycle
Transitions & animationstransition:/in:/out: and animate:flip
Forms & inputsControlled inputs, validation, and submit handling
flowchart TB
  state["reactive state (runes)"] --> bind["bind: two-way link to DOM props"]
  state --> action["use: imperative setup on an element"]
  state --> trans["transition: / animate: declarative motion"]
  bind --> dom["the DOM"]
  action --> dom
  trans --> dom
Three ways Svelte reaches the DOM
What does a `bind:` directive create?
What is a `use:` action for?
What do `transition:` and `animate:` directives do?