Animate layout movement
Animate position changes while preserving row identity.
Before you start: Collections and keys, size and spacing.
layout-position animates eligible position changes after the new layout is resolved. Stable keys relate old and new presentations. It does not create shared elements across unrelated destinations.
Move keyed rows
Each row keeps its ID when its position changes.
<Column state="{rows:[{id:'a',title:'Sketch'},{id:'b',title:'Build'},{id:'c',title:'Ship'}]}" class="p-4 gap-3">
<Button title="Reverse order" on-press="set rows to [rows[2],rows[1],rows[0]]" />
<For each="item" in="rows" key="item.id">
<Text bind-text="item.title" class="p-3 bg-card layout-position spring-soft" />
</For>
</Column>
Move keyed rows
editable
rReady to explore
Try it: Reverse repeatedly, then replace layout-position with layout-none and compare.
Host scroll, keyboard, and viewport changes should not acquire authored layout motion. Next: enter and exit. Reference: layout-position.