Skip to content
StackD
Tape measure, the StackD component

Inputs · Free

Tape measure

A slider you pull like a real tape measure: it whips back when you let go, or stays with the lock on. The Bot is the hub.

Free on Gumroad: the download arrives in your inbox.

Details

Category
Inputs
Plan
Free
Code
React + Tailwind, TypeScript · 343 lines
Files
TapeMeasure.tsx
Needs
The Bot (installed with it)
Agents
MCP server and shadcn registry

About

A slider you pull like a real tape measure. Grab the hook (or the tape) and pull: the tape runs out of its case with its marks sliding past, the coil in the case's window gets thinner and turns, and the reading at the case's mouth is the value. Let go and it whips back in and clacks home, unless the lock is on: then it stays where you left it, snapped to the step.

The Bot is the hub of the coil. It watches the hook as it moves away, and squints when the tape slams home.

Good for heights, sizes, budgets, distances or any number that's nicer to pull than to type.

React + Tailwind and the Bot, no other libraries. One real slider for the keyboard and screen readers, a real lock button, and it respects reduced motion.

Install

With the shadcn CLI:

npx shadcn@latest add https://www.stackd.codes/r/tape-measure.json

Or let your agent add it through the StackD MCP server:

claude mcp add --transport http stackd https://www.stackd.codes/mcp

Prompt for your agent

Paste it into Claude Code, Cursor, Codex or VS Code once the MCP server is connected.

Add the StackD Tape measure component to this project. Use the StackD MCP server: call get_component with { "name": "tape-measure" }, write the files at the paths it gives and install any npm packages it lists. Then use it where it fits, following its README for the props, and keep its own styles.

Use

  1. Copy TapeMeasure.tsx and Bot.tsx into the same folder (for example components/).
  2. Use it:
import { TapeMeasure } from './components/TapeMeasure'

<TapeMeasure onChange={setHeight} />

<TapeMeasure
  min={0}
  max={80}
  step={1}
  unit="in"
  defaultValue={32}
  defaultLocked
  theme="dark"
  label="Waist"
  onChange={(value) => setWaist(value)}
/>

onChange is called while it moves and once more when it settles. With the lock off, it settles back at min; with the lock on, at the value you left it on.

This Bot.tsx has the newest Bot (nine shapes). If you already use the Bot from StackD, replace it with this one; everything else stays the same.

In Next.js the files already start with 'use client'. In other React setups that line does nothing.

Options

PropDefaultWhat it does
min0The lowest value (the tape all the way in)
max200The highest value (the tape all the way out)
step1What it snaps to when you let go with the lock on
unit'cm'Shown after the number: 'cm', 'in', '€'…
defaultValueminWhere it starts
defaultLockedfalseStart with the lock on
onChangeCalled with the value while it moves and when it settles
width560Width in px; the tape can run out to the far edge. The marks adapt to the space
theme'light''light' (ink case) or 'dark' (white case)
tape'#BE9344'The tape's colour (Ochre)
bot'hexagon'The Bot's body: any of its nine shapes
label'Length'What a screen reader calls the slider

Accessibility

The tape is a real slider: Tab to it, then the arrow keys move it by one step, Page Up / Page Down by a tenth, Home and End to the ends. Screen readers read the value with its unit. The lock is a real toggle button that says whether the tape stays or goes back. With reduced motion on, the tape moves straight to where it's going, without the whip.

Colours from StackD

White #FFFFFF · Ink #141310 · Wine #901919 · Olive #6C8544 · Ochre #BE9344 · Lilac #C9B8FF

Licence

You can use it in personal and commercial projects. Don't resell or share the component on its own.

Made by StackD · stackd.codes