---
title: "Center Morph Modal"
description: "A composable modal whose full-size surface unfolds from its exact center toward every edge, then folds back the same way with an inset close control."
category: "Components"
publishedAt: "2026-07-21"
updatedAt: "2026-11-30"
documentation: "https://beui.dev/components/motion/center-morph-modal"
markdown: "https://beui.dev/components/motion/center-morph-modal.md"
license: "MIT"
---

# Center Morph Modal

> A composable modal whose full-size surface unfolds from its exact center toward every edge, then folds back the same way with an inset close control.

## Install

```bash
npx shadcn@latest add @beui/center-morph-modal
```

## Dependencies

- `@floating-ui/dom`
- `clsx`
- `lucide-react`
- `motion`
- `react`
- `react-dom`
- `tailwind-merge`

## Usage

```tsx
"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-primary px-5 text-sm font-medium text-primary-foreground 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-primary px-5 text-sm font-medium text-primary-foreground 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>
  );
}
```

## API Reference

### CenterMorphModal

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `open` | `boolean` |  | No | Controlled open state. |
| `defaultOpen` | `boolean` | `false` | No | Initial state when used uncontrolled. |
| `onOpenChange` | `((open: boolean) => void)` |  | No | Called with the new open state when the modal opens or closes. |
| `labels` | `Partial<{ close: string; dismiss: string; }>` |  | No | Override any built-in string. |

### CenterMorphModalContent

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `ariaLabel` | `string` |  | Yes | Accessible name announced by screen readers. |
| `ariaDescribedBy` | `string` |  | No | Optional id of descriptive content inside the modal. |
| `dismissible` | `boolean` | `true` | No | Close on Escape or backdrop press. Default true. |
| `showCloseButton` | `boolean` | `true` | No | Render the close control inside the panel's top-right corner. Default true. |
| `closeButtonLabel` | `string` |  | No | Accessible name and tooltip for the close button. Default: "Close modal" |
| `className` | `string` |  | No | Classes merged onto the modal panel. |
| `backdropClassName` | `string` |  | No | Classes merged onto the backdrop. |

## About Center Morph Modal

Center Morph Modal is an animated React modal dialog whose full-size surface unfolds from its exact center toward every edge, then folds back the same way on close. It is built with Framer Motion and Tailwind CSS as composable parts: CenterMorphModal, CenterMorphModalTrigger, CenterMorphModalContent and CenterMorphModalClose. The panel renders through a portal over a blurred backdrop and includes an inset close button in its top right corner.

### When to use it

- A product page needs a focused dialog for a signup, invite or upgrade prompt.
- A settings screen wants to confirm a change or show details without leaving the page.
- A gallery or feature grid opens a detail view that should feel like it grows out of the middle of the screen.

### Accessibility

The panel has the dialog role with aria-modal, takes a required ariaLabel and an optional ariaDescribedBy, and the trigger exposes aria-haspopup, aria-expanded and aria-controls. On open, focus moves to the first focusable element inside the panel and page scroll is locked. Tab and Shift Tab cycle inside the panel, including when the close button's tooltip is visible. Escape and a backdrop press close it unless dismissible is false, and focus returns to the trigger afterward. With reduced motion enabled, the center unfold is replaced by a short fade.

### FAQ

**How do I make a modal dialog in React with Framer Motion?**

Install the component with the shadcn CLI, wrap a button in CenterMorphModalTrigger, and put your content in CenterMorphModalContent with an ariaLabel. Everything sits inside a CenterMorphModal root.

**Can I control when the modal opens?**

Yes. Pass open and onOpenChange to CenterMorphModal for controlled use, or defaultOpen to let it manage its own state. CenterMorphModalClose wraps any button that should close it.

**How do I stop the modal from closing on Escape or a backdrop click?**

Set dismissible to false on CenterMorphModalContent. You can also hide the built-in close button with showCloseButton set to false or rename it with closeButtonLabel.

## Source

- Registry detail: https://beui.dev/r/center-morph-modal
- Raw source: https://beui.dev/r/center-morph-modal/raw
- GitHub: https://github.com/starc007/ui-components
