Scrub input

A number that drags sideways, types on click, and steps with the arrow keys.

Installation

Examples

Default

Every range sweeps end to end in about 250px of drag, and the cursor hides so the screen's edge doesn't stop it. A double-click restores defaultValue. onEditingChange brackets a drag or typing, so a caller can group its changes into one undo step.

demo.tsx
Size24px

Chevrons

chevrons shows arrows on hover, hinting that the value drags.

chevrons.tsx
Angle0°

Vertical

scrub="vertical" drags it up for more and down for less, as a dial does; its chevrons point up and down. scrub={false} leaves it to typing and the arrow keys.

vertical.tsx
Exposure0.0

Units

What format writes after the last digit reads as the unit. step sets how many decimals the value keeps.

units.tsx
Exposure0.35 EVOpacity80%

Fixed width

minChars keeps room for that many digits, so what sits beside the value holds still as it changes.

width.tsx
1920×1080

Anatomy

Each part's data-slot, which a theme styles, is beside it. ScrubInput renders them all from its props.