Tu altura170cm

120130140150160170180190200210220

Arrastra la cinta o usa las flechas

HTML + CSSMicrointeractions

Tape measure with inertia

Pick your height by dragging a yellow tape measure that keeps gliding with inertia and snaps to the nearest centimeter.

Settings

16px
1x
70%

Code

<div class="uvq15-tap"><p class="hd"><span>Your height</span><output class="v"><b>170</b><small>cm</small></output></p><div class="win" role="slider" tabindex="0" aria-label="Your height" aria-valuemin="120" aria-valuemax="220" aria-valuenow="170" aria-valuetext="170 cm"><div class="tp"><span style="left:calc(0 * var(--u))">120</span><span style="left:calc(10 * var(--u))">130</span><span style="left:calc(20 * var(--u))">140</span><span style="left:calc(30 * var(--u))">150</span><span style="left:calc(40 * var(--u))">160</span><span style="left:calc(50 * var(--u))">170</span><span style="left:calc(60 * var(--u))">180</span><span style="left:calc(70 * var(--u))">190</span><span style="left:calc(80 * var(--u))">200</span><span style="left:calc(90 * var(--u))">210</span><span style="left:calc(100 * var(--u))">220</span></div><i class="mk" aria-hidden="true"></i></div><p class="ht">Drag the tape or use the arrow keys</p></div>

Prompt for AI

Paste it into ChatGPT, Claude or Cursor and it will adapt the block to your project with these settings, even if you don’t use React.

Markdown version with all the code, for AI assistants

More in Microinteractions

See all Microinteractions

Where to use it

Number pickers for height, weight or quantity are tedious with plus and minus buttons. This one uses a yellow tape measure behind a red marker: drag it, flick it and it keeps gliding with momentum, stretches with resistance past either end and settles exactly on the nearest centimeter. The large readout above updates as the tape moves.

The Inertia slider decides how far a flick carries the tape. Arrow keys move one centimeter, Page Up and Page Down ten, and the mouse wheel scrolls it too. Change the range in the script and the labels in the markup to measure weight or distance instead.