04.36 · Micro-Interactions

Hold to Confirm

A button fills up while you hold it and acts only once it is full. Best for delete buttons.

Click it

Press and hold the button until it fills (or hold Space or Enter on it), or press Show me.

Old drafts

12 files · 48 MB

Try it

Change a setting, then try it again or press Show me.

How long to hold

How long the button must be held before it acts.

Fill style

A bar fills the button; a ring fills around a round button.

A small shake says the hold was too short.

More optionsFewer options

How fast it drains

How the fill runs back out when you let go early.

Copy the prompt

Paste it into an AI assistant such as ChatGPT, Claude or Cursor to build this in your own project.

Add hold to confirm to [the button for a risky action, such as Delete]. While the visitor holds it down, a fill grows steadily, and the action runs only once it is full, when a tick shows. If they let go early, the fill drains back, nothing happens and a short hint says to keep holding; when the settings ask for it, the button also shakes. Holding Space or Enter works the same way, and on touch a long press must not open the browser's menu. Grow the fill smoothly by the time held, not per frame, and announce the result to screen readers. If the visitor has reduced motion turned on, fill in a few steps without the shake. Match the settings listed below.

Replace the words in brackets with your own element. Your settings are added at the end.

Free and open source. If this helped, a star on GitHub helps other people find it.

Star on GitHub

What it is

The full explanation is in README.md.

Good for

  • Delete buttons
  • Closing an account
  • Sending money
  • Emergency alerts

Avoid on

  • Everyday actions
  • Actions with Undo