Dialog
on openDelete this animation?
This removes the document and the component source stored with it. It cannot be undone.
import { motion } from "motion/react";
export function Dialog() {
return (
<div className="relative flex h-[260px] w-full items-center justify-center overflow-hidden rounded-lg bg-muted/40">
<motion.div
className="absolute inset-0 bg-background/70"
initial={{ opacity: 0 }}
animate={{ opacity: [0, 1] }}
transition={{
opacity: { duration: 0.26, times: [0, 1], ease: "easeOut" },
}}
></motion.div>
<motion.div
className="relative w-[320px] rounded-xl border border-border bg-card p-5 shadow-xl"
initial={{ opacity: 0, y: 10, scale: 0.96 }}
animate={{ opacity: [0, 1], y: 0, scale: 1 }}
transition={{
opacity: { duration: 0.22, times: [0, 1], ease: "easeOut" },
y: { type: "spring", stiffness: 260, damping: 24, mass: 1, restDelta: 0.01, restSpeed: 0.01 },
scale: { type: "spring", stiffness: 260, damping: 24, mass: 1 },
}}
>
<h2 className="text-[15px] font-semibold text-foreground">Delete this animation?</h2>
<p className="mt-2 text-[13px] leading-relaxed text-muted-foreground">This removes the document and the component source stored with it. It cannot be undone.</p>
<div className="mt-5 flex justify-end gap-2">
<span className="rounded-md border border-border px-3 py-1.5 text-[13px] text-foreground">Cancel</span>
<span className="rounded-md bg-primary px-3 py-1.5 text-[13px] font-medium text-primary-foreground">Delete</span>
</div>
</motion.div>
</div>
);
}
The backdrop dims while the panel rises and scales up. Two layers moving together is what makes a dialog feel polished.
Open in editor