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
Installation
Basic usage
Usage
API
| Property | Type | Default | Description |
|---|---|---|---|
value | string | required | A value that identifies the current content state and starts a new morph when it changes. |
children | ReactNode | required | The current content rendered inside the persistent surface. |
transition | Transition | motionTransition.spatial | The transition used when the persistent surface changes size. |
contentTransition | Transition | motionTransition.enter | The transition used when the content changes. |
contentScale | number | 0.96 | The scale from which changed content resolves inside the surface. |
origin | MorphSurfaceOrigin | "center" | The shared origin used to grow, shrink, reveal, and scale the surface content. |
anchorClassName | string | undefined | Additional classes for the stable layout anchor around the surface. |
clipClassName | string | undefined | Additional classes for the internal clipping layer. |
contentClassName | string | undefined | Additional classes for the persistent content wrapper. |
reducedMotion | MorphSurfaceReducedMotion | "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.