Essential Dialog

A native <dialog> that grows out of its own trigger and shrinks back into it, driven by Motion's projection engine. Drag it anywhere to dismiss — the close morph starts from wherever you let go.

Prefer GSAP? The same component on GSAP Flip — identical API, identical export names, one import line apart.

The trigger is the origin: its geometry, colour and shape are what the surface grows out of.

Install

One command against the item URL — nothing to register, and it works in a project that has never heard of this registry. Motion is the only runtime dependency, and if your app already ships it the component adds nothing to the bundle.

bash
$ pnpm dlx shadcn@latest add https://essential-dialog.vercel.app/r/essential-dialog.json
Or install it by namespace

Worth registering once if you plan to pull several items — after that they resolve by name.

bash
$ pnpm dlx shadcn@latest registry add @essential=https://essential-dialog.vercel.app/r/{name}.json
$ pnpm dlx shadcn@latest add @essential/essential-dialog

Themed with CSS variables

Same component, different knobs: --essential-dialog-radius, --essential-dialog-width, --essential-dialog-padding, --essential-dialog-backdrop. Round triggers are first class: a pill or a circle keeps its roundness while it grows and only relaxes into the dialog's radius once there is enough box for a corner, because the radius is derived from the box each frame rather than tweened between two numbers.

Both buttons open the same dialog — each morph grows out of the shape you pressed, pill or circle. Drag the panel anywhere and release past 100px, or flick it, to dismiss.

Fullscreen

Opt into an edge-to-edge dialog: fullscreen for always, a number for a breakpoint — fullscreen while the viewport is narrower than that many px — or any media query string. Off by default. It only changes the box the morph lands in: the surface fills the viewport, drops its radius, adds the safe-area insets, and the content scrolls inside it.

<EssentialDialogMotion fullscreen={768}>

viewport: —px — resize the window to cross the breakpoint while the dialog is open.

Debug

Two round triggers — a pill and a circle — with debug on: every layer outlined and every frame's measurements logged. Move openDuration and closeDuration to feel why closing is shorter than opening. bounce tunes the opening spring's overshoot, and dismissOnOutsideClick turns backdrop dismissal on and off.

backdropplaceholder(Motion only)centringsurfacewindow

API Reference

Everything is optional. The parts mirror shadcn/ui's Dialog, so an existing call site ports over by renaming the imports.

EssentialDialogMotion

openDuration?
number

Seconds the trigger → dialog morph takes — a spring's visualDuration here, not a tween's duration: the time the box APPEARS to arrive, with the settle after it. Half the GSAP build's default, and it does not read as twice as fast, because most of what you see is over by then.

0.35
closeDuration?
number

Seconds the dialog → trigger morph takes. Still a tween, and evenly eased — a spring cannot be, and a decelerating close idles at full size and then collapses. Larger than openDuration here only because that one is a visual duration and this is the whole animation.

0.45
bounce?
number

Motion only. 0–1 overshoot on the opening spring — the thing a tween needs a whole new easing curve to express. 0 is the closest match to the GSAP build's curve.

0.3
draggable?
boolean

Drag the surface anywhere to dismiss. Always off under prefers-reduced-motion.

true
hideTrigger?
boolean

Hide the trigger while the dialog is open, so the button becomes the dialog instead of sitting beside it. Hidden with visibility, so the page never reflows around the gap and the close can still measure the box it lands in.

true
dismissOnOutsideClick?
boolean

Click anywhere outside the surface to dismiss. Judged on where the pointer went down AND came up, so selecting a line of text and overshooting the edge does not close the dialog. Escape is unaffected either way.

true
dismissDistance?
number

Radial px the surface must travel before release dismisses it.

100
dismissSpeed?
number

px per ms, so a flick counts even when it barely moves.

0.5
dragFalloff?
number

scale = 1 - distance / dragFalloff, floored at 0.3.

415
fullscreen?
boolean | number | string

Open edge to edge instead of centred. true is always; a number is a breakpoint (fullscreen below that many px); a string is any media query. Crossing the breakpoint while open re-lays the dialog out.

false
debug?
boolean

Outline every layer and log the boxes, live coverage and drag thresholds the morph is measured from.

false
open?
boolean

Controlled state. Drives showModal()/close() rather than rendering a different tree.

–
defaultOpen?
boolean

Open on mount. Uncontrolled only.

false
onOpenChange?
(open: boolean) => void

Fires once the morph has fully finished, in either direction.

–

EssentialDialogMotionContent

className?
string

Styles the morphing surface — the box projection transforms, and the element `drag` lives on.

–
windowClassName?
string

Styles the scrolling content box inside the surface.

–
backdropClassName?
string

Styles the backdrop element.

–
showCloseButton?
boolean

The unstyled ✕ in the corner.

true

Parts

EssentialDialogMotionTrigger
{ render?: ReactElement }

The origin of the morph. A shared layout transition needs a real node on both sides, so an invisible placeholder is stretched over this element and paired with the surface by layoutId — which is why the wrapper is inline-grid here rather than display:contents.

EssentialDialogMotionClose
{ render?: ReactElement }

Closes with the morph. Same render composition as the trigger.

EssentialDialogMotionHeader
div props

Layout only: flex column, gap 2.

EssentialDialogMotionFooter
div props

Layout only: reversed column that becomes a right-aligned row at sm.

EssentialDialogMotionTitle
h2 props

Wires aria-labelledby on the dialog.

EssentialDialogMotionDescription
p props

Wires aria-describedby on the dialog.