Dialog

A modal that tips into view from its edge while the page blurs behind it.

dialog.tsx

Installation

1

Install the packages

npm install @prequelui/react motion

@prequelui/react reuses the primitive library your components already depend on.

2

Add the component

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/dialog.json

npx shadcn@latest add https://animate.prequelui.terravidhal.me/r/dialog.json

3

Turn on the motion

npx @prequelui/cli@latest animate dialog

The CLI finds the component through components.json, swaps the import and removes the CSS animation classes that Motion replaces.

Usage

Import the component and compose it exactly like the primitive it wraps. Motion is enabled by default; the tempo prop scales every duration and softens every spring.

dialog.tsx
import {
  Dialog,
  DialogTrigger,
  DialogContent,
  DialogTitle,
  DialogDescription,
  DialogFooter,
  DialogClose,
} from "@/components/prequelui/dialog";
import { Button } from "@/components/ui/button";

export default function Demo() {
  return (
    <Dialog>
      <DialogTrigger asChild>
        <Button>Open dialog</Button>
      </DialogTrigger>
      <DialogContent side="top">
        <DialogTitle>Invite a teammate</DialogTitle>
        <DialogDescription>
          They will receive an email with a link to join this workspace.
        </DialogDescription>
        <DialogFooter>
          <DialogClose asChild>
            <Button variant="ghost">Cancel</Button>
          </DialogClose>
          <Button>Send invite</Button>
        </DialogFooter>
      </DialogContent>
    </Dialog>
  );
}
import { Dialog } from "@/components/prequelui/dialog";

export function Variant() {
  return (
    <Dialog tempo={1.2}>
      …
    </Dialog>
  );
}

Animation

The popup behaves like a card standing on the page: it tips from the edge it belongs to while the veil both tints and blurs the page behind it. The veil animates colour and filter together, never opacity alone.

  • Popup spring: stiffness 150, damping 25.
  • Entry: perspective 500 px, 20° tilt, scale 0.8, 4 px blur.
  • Exit: 200 ms away-ease, faster than the entrance and without the tilt.
  • Reopening mid-close starts from the current colour and blur.
  • Reduced motion removes the 3D tilt and the blur, keeping the fade.
spring 150 / 25rotateX 20°scale 0.8overlay 400 ms

API Reference

Every part takes exactly the props of the Dialog primitive. The animated surface adds only motion props, so the accessibility tree and keyboard behaviour stay the same.

Dialog

PropTypeDefault
openboolean—
defaultOpenbooleanfalse
onOpenChange(open: boolean) => void—
modalbooleantrue
side"top" | "bottom" | "left" | "right""top"

DialogContent

PropTypeDefault
side"top" | "bottom" | "left" | "right"inherited
showClosebooleantrue
hideOverlaybooleanfalse
transitionTransitioncomponent spring or tween
exitTransitionTransition200 ms, away ease
classNamestring—

DialogTrigger / DialogClose

PropTypeDefault
asChildbooleanfalse
classNamestring—

Built by Vidhal. The source is available on GitHub.

Last updated: 11/17/2026