Introducing Motion-Primitives Pro - Advanced components and templates to help you build a website that stands out.

Morphing Dialog

A dialog that uses layout animations to transition content into a focused view. It supports click-outside and escape key functionalities for closing.

Examples

Morphing Dialog Basic

Morphing Dialog Basic 2

Morphing Dialog Image

Installation

npx shadcn add "https://motion-primitives.com/c/morphing-dialog.json" "https://motion-primitives.com/h/useClickOutside.json"

Component API

MorphingDialog

PropTypeDefaultDescription
childrenReactNodeThe content of the dialog which could include triggers and content.
transitionTransitionTransition settings from motion for animation effects.

MorphingDialogTrigger

PropTypeDefaultDescription
childrenReactNodeContent of the trigger, typically a string or formatted text.
classNamestringOptional CSS class for styling the trigger element.
styleReact.CSSPropertiesInline styles for the trigger element.
triggerRefReact.RefObjectRef to attach to the trigger element, useful for managing focus.

MorphingDialogContent

PropTypeDefaultDescription
childrenReactNodeThe content displayed within the dialog when it is open.
classNamestringOptional CSS class for styling the content container.
styleReact.CSSPropertiesInline styles for the content container.

MorphingDialogTitle

PropTypeDefaultDescription
childrenReactNodeThe title content of the dialog.
classNamestringOptional CSS class for the title element.
styleReact.CSSPropertiesInline styles for the title element.

MorphingDialogSubtitle

PropTypeDefaultDescription
childrenReactNodeThe subtitle content of the dialog.
classNamestringOptional CSS class for the subtitle element.
styleReact.CSSPropertiesInline styles for the subtitle element.

MorphingDialogDescription

PropTypeDefaultDescription
childrenReactNodeThe descriptive content of the dialog.
classNamestringOptional CSS class for the description container.
disableLayoutAnimationbooleanfalseIf true, disables layout animations for the description.
variantsObjectVariants for the animation states of the description.

MorphingDialogImage

PropTypeDefaultDescription
srcstringImage source URL.
altstringAlternative text for the image.
classNamestringOptional CSS class for the image element.
styleReact.CSSPropertiesInline styles for the image element.

MorphingDialogClose

PropTypeDefaultDescription
childrenReactNodeOptional custom content for the close button, defaults to X icon.
classNamestringOptional CSS class for the close button.
variantsObjectVariants for the animation states of the close button.