Scrub Inputs, animated React component
Design-tool number fields: drag a label sideways to change the value, with Shift for big steps and Alt for fine ones. A badge shows how far you have moved, then reports the change when you let go.
- Pro
- Inputs & Controls
- Spring
Play with it
Move the controls and watch it change. Copy code gives you a snippet with only the props you changed.
px
°
%
Drag a label sideways. Shift for big steps.Props
| Prop | Type | Default | What it does |
|---|---|---|---|
| label | string | — | ScrubInput: field name; dragging it changes the value. |
| value | number | — | ScrubInput: the current value (controlled). |
| onChange | (v: number) => void | — | ScrubInput: called with each new value while dragging, typing or using the arrow keys. |
| min | number | — | ScrubInput: lowest allowed value. |
| max | number | — | ScrubInput: highest allowed value. |
| step | number | 1 | ScrubInput: change per two pixels of drag and per arrow key press. |
| unit | string | "" | ScrubInput: suffix shown after the number and in the change badge. |
| accent | string | "#0071e3" | Both: badge colour while dragging; ScrubInputs also starts its sample shape's gradient with it. |
| autoplay | boolean | false | ScrubInputs: changes the three sample fields by itself until someone touches them. |