kuratlielia

Scrub Input

Component

About

A draggable number input field, like Figma's inspector fields, where dragging the label scrubs the value and typing accepts units and arithmetic expressions.

Built with React and Tailwind. Copy the prompt and paste it into Claude Code, Cursor or Lovable: your agent adds Scrub Input to your project and fits it to your theme.

Code

How Scrub Input is used: the demo's code. The component's own source comes with a free account.

Usage.tsx

"use client";

import { ScrubInput } from "@/components/ui/scrub-input";
import { useState } from "react";

export default function ScrubInputDemo() {
  const [width, setWidth] = useState(240);
  const [opacity, setOpacity] = useState(100);

  return (
    <div className="flex w-full max-w-xs flex-col gap-2">
      <ScrubInput
        label="W"
        value={width}
        onValueChange={setWidth}
        min={0}
        units={["px", "%"]}
        resetValue={240}
      />
      <ScrubInput
        label="Opacity"
        value={opacity}
        onValueChange={setOpacity}
        min={0}
        max={100}
        unit="%"
      />
    </div>
  );
}

Dependencies

More by kuratlielia

View all
  • Activity Heatmap

    Activity Heatmap

    523
  • Image Compare

    Image Compare

    225
  • Stats Band

    Stats Band

    165
  • User Menu

    User Menu

    118
  • Date Range Picker

    Date Range Picker

    111
  • Usage Meter

    Usage Meter

    83
  • Ridgeline Chart

    Ridgeline Chart

    70
  • Timeline

    Timeline

    61