Scrub Inputs, animated React component
- Pro
- Inputs & Controls
- Spring
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.
Ticks for each step as you scrub a number sideways or press up and down. Sound is off on this site until you switch it on.
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. |
| enableSound | boolean | true | Plays interface sounds on interaction. They follow the sound switch (setSoundsEnabled, on by default) and stay silent on hover. Autoplay makes the same sounds once the visitor has used the page. Pass false to silence this component. |
Add it to your project
- 1
Set up your project once
You need a Next.js project with Tailwind CSS and the
@/import alias. In its root folder, run this once. It createscomponents.jsonand thecn()helper insrc/lib/utils.ts:npx shadcn@latest init -d
Starting from nothing? The Quick Start walks through the whole thing.
- 2
Connect the registry with your API key
Scrub Inputs is a Pro item, so the CLI has to send your API key. Do this once per project:
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
nxs_and is shown only once. - In your project root, next to
package.json, create a file named.env.localwith this line, using your own key:NEXUS_API_KEY=nxs_your_key_here
- Open
components.jsonand add this entry inside the outermost braces, next to"aliases". Leave{name}and${NEXUS_API_KEY}exactly as written; the CLI fills them in:"registries": { "@nexus-labs": { "url": "https://www.nexus-ui.com/api/registry/{name}", "headers": { "Authorization": "Bearer ${NEXUS_API_KEY}" } } }
- Create a key at nexus-ui.com/dashboard/api-key. Copy it straight away: it starts with
How Scrub Inputs works
Drag the label (or the number) sideways to change the value, like a design tool. Shift moves ten times faster, Alt ten times finer. A badge rides above the number showing how far you have moved from where you started.
The source, the install command and the build prompt come with Pro.
Scrub Inputs questions
Does it make sound, and how do I turn it off?
Ticks for each step as you scrub a number sideways or press up and down. Sounds are synthesised with the Web Audio API, so there are no audio files, and they only play after a click or key press. Pass `enableSound={false}` to silence this component, or call `setSoundsEnabled(false)` from `@/lib/ui-sounds` to switch every sound off at once. The CLI installs `@/lib/ui-sounds` with the component.

