Center Morph Modal
Center Morph Modal composes trigger, content and close controls around open state.
Practical React example
Open a centred detail dialog from a visible trigger.
Before you copy and paste
Keep the example in the React rendering environment required by the imported component. Copy components/motion/center-morph-modal.tsx and its returned support files from the Code tab; preserve the project-relative paths.
Listed package dependencies: clsx, lucide-react, motion, react, react-dom, tailwind-merge.
Use the Code tab for the component files and installation instructions, then adapt the imports in this example to your project.
Open a centred detail dialog from a visible trigger
// Usage adapted from beUI's pinned MIT source.
// Copyright (c) 2026 Saurabh Chauhan. See ./LICENSES.md.
"use client";
import { ArrowUpRight, Check } from "lucide-react";
import {
CenterMorphModal,
CenterMorphModalContent,
CenterMorphModalTrigger,
} from "@/components/motion/center-morph-modal";
export function CenterMorphModalPreview() {
return (
<div className="flex min-h-[420px] w-full items-center justify-center">
<CenterMorphModal>
<CenterMorphModalTrigger>
<button
type="button"
className="inline-flex h-10 items-center justify-center rounded-full bg-foreground px-5 text-sm font-medium text-background press focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
Open modal
</button>
</CenterMorphModalTrigger>
<CenterMorphModalContent
ariaLabel="beUI Pro"
ariaDescribedBy="center-morph-pro-description"
>
<div className="p-7 sm:p-8">
<p className="text-sm font-medium text-muted-foreground">
beUI Pro
</p>
<h2 className="mt-5 max-w-xs pr-8 text-2xl font-medium tracking-tight text-foreground">
Ship the whole experience.
</h2>
<p
id="center-morph-pro-description"
className="mt-3 text-sm leading-relaxed text-muted-foreground"
>
Go beyond individual components with premium animated sections
and complete Next.js templates.
</p>
<div className="mt-7 space-y-3 border-y border-border py-5">
{[
"Premium animated sections",
"Complete Next.js templates",
"Editable source and private registry",
].map((feature) => (
<div
key={feature}
className="flex items-center gap-3 text-sm text-foreground"
>
<Check
className="h-4 w-4 text-muted-foreground"
aria-hidden="true"
/>
<span>{feature}</span>
</div>
))}
</div>
<a
href="https://pro.beui.dev/?utm_source=beui&utm_medium=component_preview&utm_campaign=center_morph_modal"
target="_blank"
rel="noreferrer"
className="mt-7 inline-flex h-11 w-full items-center justify-center gap-2 rounded-full bg-foreground px-5 text-sm font-medium text-background press focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
>
Explore beUI Pro
<ArrowUpRight className="h-4 w-4" aria-hidden="true" />
</a>
</div>
</CenterMorphModalContent>
</CenterMorphModal>
</div>
);
}
Usage example adapted from beUI's pinned MIT source. Retain the source licence notices when copying.
Give the content an ariaLabel and associate a description when it adds context. Use controlled state if another workflow opens or closes the dialog.
Customization
- CenterMorphModalProps.children
- Required; ReactNode.
- CenterMorphModalProps.open
- Optional; boolean. Controlled open state.
- CenterMorphModalProps.defaultOpen
- Optional; boolean. Initial state when used uncontrolled.
- CenterMorphModalProps.onOpenChange
- Optional; (open: boolean) => void.
- CenterMorphModalTriggerProps.children
- Required; ReactElement.
- CenterMorphModalCloseProps.children
- Required; ReactElement.
- CenterMorphModalContentProps.children
- Required; ReactNode.
- CenterMorphModalContentProps.ariaLabel
- Required; string. Accessible name announced by screen readers.
- CenterMorphModalContentProps.ariaDescribedBy
- Optional; string. Optional id of descriptive content inside the modal.
- CenterMorphModalContentProps.dismissible
- Optional; boolean. Close on Escape or backdrop press. Default true.
- CenterMorphModalContentProps.showCloseButton
- Optional; boolean. Render the close control inside the panel's top-right corner. Default true.
- CenterMorphModalContentProps.closeButtonLabel
- Optional; string.
- CenterMorphModalContentProps.className
- Optional; string.
- CenterMorphModalContentProps.backdropClassName
- Optional; string.
Integration notes
- A background press or Escape should not silently discard important work.
- Test initial focus, focus containment and return to the trigger after closing.
Component source: beUI documentation . These examples describe the version imported into Rendyn. Upstream APIs may have changed; retain the source licence notices when adapting the code.
Give your agent taste.
The best way to use Rendyn is through MCP. Let your agent find the right component, compare previews and bring the source into your project.
All components are free. Sign up only to connect MCP.