Skip to main content

Animate size and spacing

Animate real layout changes explicitly.

Before you start: Transforms and conditional content.

transition-size changes allocated dimensions. Unlike scaling painted pixels, it can move following content. transition-spacing changes resolved padding and gaps. These are explicit choices because they require layout work.

Animate explicit width​

The width changes while height stays fixed.

<Column state="{changed:false}" class="p-4 gap-3">
<View bind-class="'h-12 bg-accent transition-size ' + (changed ? 'w-48' : 'w-16')" />
<Button title="Change target" on-press="toggle changed" />
</Column>
Animate explicit width
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Change the expanded width from w-48 to w-32.

Expand retained content​

A retained show panel can expand to its measured content height.

<Column state="{open:false}" class="p-4 gap-3">
<Button title="Expand" on-press="toggle open" />
<Column show="open" class="p-3 bg-card transition-size overflow-hidden">
<Text text="Natural content height" />
<Text text="The following label moves with the panel." />
</Column>
<Text text="Following content" />
</Column>
Expand retained content
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Add another text line and reverse expansion before it finishes.

Animate a gap​

Only the gap changes here; both labels remain in real layout.

<Column state="{changed:false}" class="p-4 gap-3">
<Column bind-class="'p-2 bg-card transition-spacing ' + (changed ? 'gap-6' : 'gap-1')">
<Text text="First row" /><Text text="Second row" />
</Column>
<Button title="Change target" on-press="toggle changed" />
</Column>
Animate a gap
editable
Browser preview
rReady to explore
Environment & events

Browser rendering of the shared document. Host services are bundled demo mocks. XML edits reset local state; data edits preserve compatible state.

Interact with the preview to inspect emitted events and mocked service calls.

Try it: Replace the gap change with p-2 / p-6 to explore padding.

Check focus, scrolling, and changing text while expanding. Reduced/off policy snaps to target layout. Next: keyed layout movement.