A modal dialog with morphing animations, spring physics, and focus management. Built with Motion for smooth layout animations and transitions.
import {
AlertDialog,
AlertDialogTrigger,
AlertDialogContainer,
AlertDialogContent,
AlertDialogBody,
AlertDialogHeader,
AlertDialogFooter,
AlertDialogTitle,
AlertDialogSubtitle,
AlertDialogDescription,
AlertDialogAction,
AlertDialogCancel,
} from "@/components/ui/alert-dialog"<AlertDialog transition={{ type: "spring", bounce: 0.25, duration: 0.5 }}>
<AlertDialogTrigger>
<Button>Show Details</Button>
</AlertDialogTrigger>
<AlertDialogContainer>
<AlertDialogContent>
<AlertDialogBody>
<AlertDialogHeader>
<AlertDialogTitle>Spring Animation</AlertDialogTitle>
<AlertDialogSubtitle>With custom transition</AlertDialogSubtitle>
<AlertDialogDescription>
This dialog uses spring physics for smooth animations.
</AlertDialogDescription>
</AlertDialogHeader>
<AlertDialogFooter>
<AlertDialogCancel className="w-full">Dismiss</AlertDialogCancel>
</AlertDialogFooter>
</AlertDialogBody>
</AlertDialogContent>
</AlertDialogContainer>
</AlertDialog>This will also install: motion-provider, button
A morphing dialog with smooth layout animations and spring physics.
Use subtitle for additional context and custom spring transitions.
Example use cases for morphing dialogs.
The Container renders content in a portal with backdrop overlay.
Provides consistent padding (p-6 sm:p-8), centered layout, and proper spacing.
asChild with Button so only the surface morphs and text stays crisp.Alert dialog pattern for critical actions that require confirmation.
• role="alertdialog" with aria-modal
• Title linked via aria-labelledby
• Async states use aria-busy