Skip to content

Layout morph

Animates the height of a container when its content changes.

First light

The wall before the room wakes up.

layout-morph-demo.tsx

Installation

The CLI adds the files, packages, theme variables, and Tailwind plugin that this component uses. Before you run it, set up your project.

Switching views

Keep the control outside LayoutMorph, so focus stays on the control. Also install Toggle button group.

$12 per month

  • Unlimited projects
  • Shared libraries
layout-morph-views-demo.tsx

Width

Set w-fit on LayoutMorph to animate the width. Also install Toggle button group and Spinner.

Saved
layout-morph-width-demo.tsx

API reference

contentKey: string | numberRequired
Change it with the content to crossfade the content and animate the size. The width animates only when the morph fits its content, such as with w-fit. Other size changes, such as a window resize, do not animate.