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.
$ pnpm dlx shadcn@latest add https://essential-dialog.vercel.app/r/essential-dialog.jsonOr install it by namespace
Worth registering once if you plan to pull several items — after that they resolve by name.
$ pnpm dlx shadcn@latest registry add @essential=https://essential-dialog.vercel.app/r/{name}.json
$ pnpm dlx shadcn@latest add @essential/essential-dialogThemed 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.
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?numberSeconds 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.35closeDuration?numberSeconds 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.45bounce?numberMotion 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.3draggable?booleanDrag the surface anywhere to dismiss. Always off under prefers-reduced-motion.
truehideTrigger?booleanHide 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.
truedismissOnOutsideClick?booleanClick 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.
truedismissDistance?numberRadial px the surface must travel before release dismisses it.
100dismissSpeed?numberpx per ms, so a flick counts even when it barely moves.
0.5dragFalloff?numberscale = 1 - distance / dragFalloff, floored at 0.3.
415fullscreen?boolean | number | stringOpen 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.
falsedebug?booleanOutline every layer and log the boxes, live coverage and drag thresholds the morph is measured from.
falseopen?booleanControlled state. Drives showModal()/close() rather than rendering a different tree.
–defaultOpen?booleanOpen on mount. Uncontrolled only.
falseonOpenChange?(open: boolean) => voidFires once the morph has fully finished, in either direction.
–EssentialDialogMotionContent
className?stringStyles the morphing surface — the box projection transforms, and the element `drag` lives on.
–windowClassName?stringStyles the scrolling content box inside the surface.
–backdropClassName?stringStyles the backdrop element.
–showCloseButton?booleanThe unstyled ✕ in the corner.
trueParts
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.
EssentialDialogMotionHeaderdiv propsLayout only: flex column, gap 2.
EssentialDialogMotionFooterdiv propsLayout only: reversed column that becomes a right-aligned row at sm.
EssentialDialogMotionTitleh2 propsWires aria-labelledby on the dialog.
EssentialDialogMotionDescriptionp propsWires aria-describedby on the dialog.