Micro-interactions

Morph Dialog

A dialog that morphs open from its trigger via shared-layout animation, with elements that travel between card and panel.

Install

bun add motion lucide-react clsx tailwind-merge

Then copy 2 files into your project:

  • components/registry/morph-dialog/morph-dialog.tsx
  • lib/utils.ts

Props

PropTypeDefaultDescription
stiffnessnumber320Spring stiffness of the morph.
dampingnumber34Spring damping — lower rings longer.
radiusnumber16Panel corner radius.
blurBackdropbooleantrueFrosted blur on the backdrop scrim.
autoFocusbooleantrueFocus the first focusable element on open.

What It Demonstrates

Shared element transition
An element travels and transforms from one position into another, like a thumbnail expanding into a card.
Layout animation
When an element's size or position changes, it animates to the new spot instead of snapping.
Morph
One shape smoothly turns into another shape, e.g. Dynamic Island.
Origin-aware animation
An element animates out of its trigger, like a popover growing from the button that opened it instead of from its own center which is the default in CSS.
Continuity transition
A change that keeps the user oriented by visually connecting before and after. For example, making the same rectangle bigger and smaller.

Related Components

Appears In