Skip to content
IndexRequest a UIAboutContact

Slide to Confirm

A confirmation control where a thumb must be dragged all the way across to proceed.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Create a slide-to-confirm control 280px wide and 52px tall with a pill-shaped track, a label "Slide to pay" centered, a progress fill that grows with the thumb and a 44px circular thumb button with an arrow. Use pointer events on the thumb with touch-action none: move it horizontally within the track, set the fill width and the label opacity to 1 minus progress. On release at 90% or more, move it to the end, replace the arrow with a check mark, change the label to "Paid" and lock the control; otherwise return the thumb with a 260ms cubic-bezier(.2,.7,.2,1) transition. Give the thumb role slider with aria-valuemin 0, aria-valuemax 100 and aria-valuenow updated, aria-label "Slide to pay"; ArrowRight and ArrowLeft change the value by 25 and reaching 100 confirms. Add a small Reset link after confirming. Under prefers-reduced-motion remove transitions.

About this pattern

Definition

A track with a draggable thumb. The action only happens when the thumb is dragged to the end, which prevents accidental taps on important actions.

Purpose & UX principles

  • Adds deliberate friction to actions that are costly to trigger by mistake, such as payments or unlocking.
  • A label on the track explains the action; the track text fades as the thumb moves.
  • Keyboard and assistive technology users press ArrowRight on the thumb or use Enter to confirm in steps.

Interaction states

  • Idle, dragging, confirmed (check mark, locked), released early (springs back), focus-visible.

Motion specification

  • The thumb follows the pointer with no delay; release back is 260ms cubic-bezier(.2,.7,.2,1).
  • The fill behind the thumb grows with it; the label opacity follows 1 - progress.
  • Reduced motion: no spring, thumb jumps back instantly.

Responsive behaviour

  • Track width follows its container with a 52px tall thumb for easy touch.
  • Distance is measured relative to the track, so it works at any width.

Code

HTML
<div class="box">
  <div class="track" id="trk"><div class="fill" id="fill"></div><span class="lbl" id="lbl">Slide to pay</span>
    <div class="thumb" id="th" role="slider" tabindex="0" aria-label="Slide to pay" aria-valuemin="0" aria-valuemax="100" aria-valuenow="0">→</div></div>
  <button class="reset" id="rs" type="button" hidden>Reset</button>
</div>

Related patterns

Swipe to Delete

↗
Swipe to DeleteGestures & Touch

Press Feedback

↗
Press FeedbackButtons & Actions

Modal Dialog

↗
Modal DialogOverlays & Dialogs