Motion-Primitives Pro is live - Advanced components and templates to help you build delightful websites, faster.

Morphing Popover

A popover that transforms from its trigger into the content using layout animations. It visually morphs instead of appearing as a separate element.

Examples

Morphing popover basic

Morphing popover with custom transition variants

You can pass a custom transition and variants to the popover with the variants and transition props.

Morphing popover with textarea

Installation

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

Component API

MorphingPopover

PropTypeDefaultDescription
childrenReact.ReactNodeRequiredThe content of the popover (trigger and content)
transitionTransition{ type: 'spring', bounce: 0.1, duration: 0.4 }Custom transition settings for the animations
defaultOpenbooleanfalseWhether the popover is open by default
openbooleanundefinedControlled open state
onOpenChange(open: boolean) => voidundefinedCallback fired when open state changes
variantsVariantsundefinedCustom variants for the animation
classNamestringundefinedAdditional CSS classes

MorphingPopoverTrigger

PropTypeDefaultDescription
childrenReact.ReactNodeRequiredThe trigger element content
asChildbooleanfalseWhether to merge props onto the child element
classNamestringundefinedAdditional CSS classes

MorphingPopoverContent

PropTypeDefaultDescription
childrenReact.ReactNodeRequiredThe content to display in the popover
classNamestringundefinedAdditional CSS classes