In this tutorial, we're going to build the Modal dialog example step-by-step.

This example is rated advanced difficulty, which means we assume you're already quite familiar with Motion (and JavaScript in general).

Here's a live demo of the example we're going to be creating:

Loading...

Checking Motion+ status…

The Modal dialog tutorial

is exclusive to Motion+

300+ examples & 40+ tutorials

Premium APIs

Motion Studio editing tools

alpha

Discord community

Early access

Lifetime updates

One-time payment, lifetime updates

Already joined?

Introduction

The Modal dialog example shows how to create a smooth, interactive modal using Motion and the HTML <dialog> element. This example uses the animate() function to orchestrate opening and closing animations, hover() to add scale effects on hover, and press() to handle tap interactions. Together, these Motion APIs create a polished modal experience with 3D perspective transforms, backdrop animations, and multiple ways to dismiss the dialog.

Motion is supported by the best in the industry.