Skip to content
IndexRequest a UIAboutContact

Rubber Band Drag Resistance

Drag a card past its limit and feel the resistance grow, then see it spring back when released.

Open alone ↗

AI prompt

PROMPT: PASTE INTO YOUR AI CODING TOOL
Illustration sequence of a horizontal slider handle dragged past the right end of its track, three frames, the first with the handle at the end of the track, the second with the handle pulled beyond the end and the track stretching like a thin elastic band with a faint resistance curve above it, the third with the handle snapping back, soft blue palette on off-white, minimal flat vector style. Negative: gradients, shadows, text errors, clutter. Reduced motion: static sequence.

About this pattern

Definition

Rubber banding gives drag a physical feel at the edge of a range. Inside the limits the element follows the finger one to one. Beyond them it moves less and less per pixel dragged, as if stretching a rubber band, and springs back when released. It tells people they have reached the end without a hard stop.

Purpose & UX principles

  • Inside the range: position equals pointer movement.
  • Beyond the range: apply damping, for example distance times 0.4 divided by one plus distance over a constant.
  • On release, animate back to the limit with a spring or ease-out.
  • Use pointer events and touch-action so the drag works on touch devices.

Interaction states

  • A draggable handle on a track with a range of 0 to 100, damping presets and a reset.

Motion specification

  • The spring-back takes about 400ms.
  • Reduced motion: no spring; it snaps to the limit.

Responsive behaviour

  • Keep the stretch small, around 30 to 60 pixels, so nothing looks broken.
  • Offer button alternatives for people who cannot drag precisely.

Code

HTML
<div class="bx"><div class="pre" id="pre" role="group" aria-label="Resistance"><button data-p="0" aria-pressed="true">Soft</button><button data-p="1" aria-pressed="false">Medium</button><button data-p="2" aria-pressed="false">Stiff</button></div><div class="tk" id="tk"><i class="rg" id="rg"></i><b class="hd" id="hd" tabindex="0" role="slider" aria-valuemin="0" aria-valuemax="100" aria-valuenow="30" aria-label="Value"></b></div><p class="out" id="out"></p></div>

Related patterns

Pull to Refresh

↗
Pull to RefreshGestures & Touch

Drag to Reorder

↗
Drag to ReorderGestures & Touch

Spring Follow

↗
Spring FollowMotion & Transitions