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. - Attachments and actions —
{@attach}(Svelte 5.29+) runs imperative setup on an element or component and re-runs when its inputs change;use:actions are the legacy form for libraries that still ship them. 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.
What this module covers
Section titled “What this module covers”| Lesson | What you’ll learn |
|---|---|
| Bindings | bind:value, bind:this, bind:group, and component bindings |
| Actions | Attachments ({@attach}) first, then the legacy use: directive and fromAction |
| Transitions & animations | transition:/in:/out: and animate:flip |
| Forms & inputs | Controlled 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