Morph Surface

Morph Surface is an unstyled layout primitive for changing the dimensions and content of one persistent surface. The same surface grows, shrinks, clips, and reveals around a shared center origin by default, while styling, state, focus behavior, and product actions remain consumer-owned.

Preview

Reduce motion:Off
Inspect

Installation

Basic usage

TypeScript
morphing-panel.tsx

Usage

API

PropertyTypeDefaultDescription
valuestringrequiredA value that identifies the current content state and starts a new morph when it changes.
childrenReactNoderequiredThe current content rendered inside the persistent surface.
transitionTransitionmotionTransition.spatialThe transition used when the persistent surface changes size.
contentTransitionTransitionmotionTransition.enterThe transition used when the content changes.
contentScalenumber0.96The scale from which changed content resolves inside the surface.
originMorphSurfaceOrigin"center"The shared origin used to grow, shrink, reveal, and scale the surface content.
anchorClassNamestringundefinedAdditional classes for the stable layout anchor around the surface.
clipClassNamestringundefinedAdditional classes for the internal clipping layer.
contentClassNamestringundefinedAdditional classes for the persistent content wrapper.
reducedMotionMorphSurfaceReducedMotion"user"Controls whether the surface follows, forces, or ignores reduced motion.

Accessibility

Morph Surface follows the user's reduced-motion preference by default and applies dimension and content changes immediately when motion is reduced. Consumers remain responsible for focus movement, accessible labels, and announcing meaningful state changes.

Styling

The primitive carries no visual surface styles. Apply the background, radius, and elevation to the persistent root with className. Put state-specific spacing and dimensions on the content rendered inside it. An internal clip layer preserves the root elevation while clipping content to the inherited radius.

Contact

Found a bug or need help using this component? Open an issue on GitHub.

License & Usage

Sona UI is available under the MIT license. You may use, modify, and distribute this component in personal and commercial projects.

Was this component useful?

Your feedback helps us improve the documentation.

Related components