Hold to confirm: Step-by-step tutorial

Matt Perry
In this tutorial, we're going to build the Hold to confirm example step-by-step.
This example is rated 3/5 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:
Checking Motion+ status…
The Hold to confirm tutorial
is exclusive to Motion+
290+ examples & 35+ tutorials
Premium APIs
Visual editor for VS Code
alpha
Discord community
Early access
Lifetime updates
One-time payment, lifetime updates
Already joined?
Introduction
The Hold to Confirm example shows how to create a button that visually responds to a long press, before confirming an action.
In this tutorial, we'll learn how to use:
useMotionValue
to track the progress of holding the buttonuseTransform
to link animated values to that progressanimate
to animate the progress value