Morph
Also called shape morphing or morphing animation
A transition where one shape smoothly changes its size, corners, and contents into another, like a small pill growing into a full card.
import { AnimatePresence, motion, MotionConfig } from 'motion/react';
const SIZE = { idle: 'h-9 w-30', timer: 'h-9 w-60', music: 'h-35 w-80' };
const RADIUS = { idle: 18, timer: 18, music: 32 };
type Activity = keyof typeof SIZE;
export function StatusIsland({ activity }: { activity: Activity }) {
return (
// reducedMotion='user' makes the size change instant for people who prefer less motion.
<MotionConfig
reducedMotion='user'
transition={{ type: 'spring', bounce: 0.25, duration: 0.5 }}
>
{/* layout animates the new size; animating borderRadius keeps the corners round while it scales. */}
<motion.div
layout
initial={false}
animate={{ borderRadius: RADIUS[activity] }}
className={`relative overflow-hidden bg-black text-white ${SIZE[activity]}`}
>
{/* The content fades separately, so text never stretches with the shape. */}
<AnimatePresence mode='popLayout' initial={false}>
<motion.div
key={activity}
layout
initial={{ opacity: 0 }}
animate={{ opacity: 1, transition: { delay: 0.1 } }}
exit={{ opacity: 0, transition: { duration: 0.1 } }}
className='flex size-full items-center gap-3 px-4 text-sm'
>
{activity === 'timer' && (
<>
<span>Focus</span>
<span className='ml-auto text-orange-400 tabular-nums'>
24:59
</span>
</>
)}
{activity === 'music' && (
<>
<span className='size-16 shrink-0 rounded-xl bg-linear-to-br from-fuchsia-500 to-orange-400' />
<span>
<span className='block font-medium'>Midnight City</span>
<span className='block text-white/60'>M83</span>
</span>
</>
)}
</motion.div>
</AnimatePresence>
</motion.div>
</MotionConfig>
);
}Build a Dynamic Island–style status pill: a black 120×36px pill at the top of the screen that morphs into a 240×36px timer and then into a 320×140px music player card. Animate size and corner radius as one shape with a spring (bounce 0.25, about 500ms), fade the inner content in after the shape starts moving, and switch instantly when prefers-reduced-motion is set.
Paste into Layerwise or any AI coding tool.
What is Morph?
A morph treats two states as the same object. Instead of hiding a small element and showing a big one, the element itself stretches, changes its corner radius, and swaps its contents while it changes shape. Apple’s Dynamic Island is the best-known example: a small black pill that grows into a timer, a call screen, or a music player.
Use it when a compact control expands into something larger and back: a search icon opening into a search field, a floating button turning into a menu, a badge expanding into a message preview. Because the shape never disappears, people can tell the big version came from the small one.
In code, most interface morphs are layout animations: you change the element’s size in CSS and let a library like Motion animate the difference with transforms. Fade the inner content separately so text does not stretch, and animate the corner radius through Motion so the corners stay round while the shape scales. The word also covers SVG shape morphing, where one icon outline turns into another, such as a menu icon becoming an X.
Often confused with
- Shared element transition
- A shared element transition carries one element between two separate views. A morph reshapes one element in place.
Related terms
All termsLayout animation
An animation that smoothly moves and resizes elements when the layout changes, such as list items gliding to new spots after a sort or filter.
Continuity transition
A transition where one element keeps its identity as it changes role, like an “Add to cart” button that becomes a progress bar, then a checkmark.
Spring animation
An animation driven by simulated spring physics in place of a fixed duration and curve, so motion can overshoot, settle, and react naturally.
Text morph
A text transition where the letters two words share slide to their new spots while the others fade out or in, so a label changes without a hard cut.
Build it with Layerwise
Describe your app, watch it run in a live preview, and publish it with a database, storage, and sign-in built in.