Skip to content
Back

Scrub inputPro

A Figma-style number field: drag the label to scrub with fine and coarse gears, type values with units or arithmetic, wrap rotations, and feel a rubber-band strain at the limits.

oxyn add scrub-input
px
Drag a label · Shift ×10 · Alt ×0.1 · type 12*2 or 50% · double-click resets
The code is part of Oxyn Pro

The preview stays free for everyone. Pro opens the code of every Pro component, screen, agent-app template, block and kit, plus the Pro CLI.

Get Pro

Rendered from Rust at build time · goes live when visible

When to use

  • A Figma-style number field.
  • Drag the label sideways to scrub (px_per_step, 2 px a step); Shift ten times coarser and snapped to the coarse grid, Alt ten times finer; changing gear mid-drag re-anchors so the value never jumps and a ×10 / ×0.1 badge shows.
  • Typed text accepts units from units and arithmetic (12*2, (1+2)*3) through parse_value / eval.
  • Escape restores typing or cancels a scrub back to where it started; double-click the label resets to reset_value.

When not to use

  • On or off for things that apply right away: use Switch instead.
  • A real checkbox with a label and second line, an indeterminate state for Select all, an error, a card row and a check that draws itself: use Checkbox instead.
  • Pick one: use Radio group instead.

Installation

Scrub input is part of Oxyn Pro; the preview is free. Pro items install with the oxyn CLI once your licence is signed in; until then Pro members copy the code from this page.

Terminal
oxyn add scrub-input

Usage

Dioxus · rust
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Examples

Size

W with px / % / rem cycling and X without limits.

px
Drag a label · Shift ×10 · Alt ×0.1 · type 12*2 or 50% · double-click resets
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Rotation

Rotation that wraps from 360 back to 0.

°
Drag a label · Shift ×10 · Alt ×0.1 · type 12*2 or 50% · double-click resets
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

Opacity

Percent with a quiet track; double-click resets to 100.

%
Drag a label · Shift ×10 · Alt ×0.1 · type 12*2 or 50% · double-click resets
Code Pro
The code is part of Oxyn Pro

The preview is free. Pro opens the code of every Pro component, screen and template.

Get Pro

API reference

ScrubInput

PropTypeDefaultDescription
labelrequiredString—Label (the drag handle).
valuef64Default::default()Starting value.
minf64f64::NEG_INFINITYLower limit.
maxf64f64::INFINITYUpper limit.
stepf641.0One step.
px_per_stepf322.0Pointer travel for one step.
wrapboolDefault::default()Wrap from max to min.
unitsVec<String>Default::default()Units a typed value may carry; more than one makes the unit a button that cycles them.
unitStringDefault::default()Starting unit.
reset_valueOption<f64>Default::default()Double-click the label to return here.
trackbooltrueShow the track fill (needs both limits).
sizeString"md"`sm` · `md`.
disabledboolDefault::default()Disabled.
nowrequiredClockMs—Shared clock (the kick).
on_changeEventHandler<(f64, String)>—Every change: value and unit.
on_commitEventHandler<(f64, String)>—Once a change settles.

Read from the Rust signature and doc comments.

Keyboard interactions

KeyAction
↑or↓Step (Shift ×10, Alt ×0.1)
EnterCommit typed text, units or arithmetic
EscapeRestore while typing, or cancel a scrub

Accessibility

  • The input is role=spinbutton; the label is the drag handle and stays a real <label>.
  • Reduced motion removes the strain, shake and glide.
From the spec
  • The input is role=spinbutton; the label remains a <label> for the input.
  • The unit button names the current unit.

Motion & interaction

Timing
  • Strain: rubber(over, 12); release springs back on a 300 ms overshooting curve.
  • Track fill glides 200 ms to typed or stepped values and follows a drag one to one.
  • Reduced motion removes the strain, shake and glide; units swap with a fade.

Responsive behaviour

  • 150 px wide; grows with its container.
Edge cases (spec)
  • 150 px default; sm is 26 px tall.

Notes for AI

  • Import ScrubInput from oxyn_dioxus and include STATUS_INDICATOR_CSS plus the token stylesheet once.
  • A GPUI version exists: ScrubInputEl in oxyn_gpui.
  • Props to set first: label, now.
  • It reads a clock (now) for live timers; pass one clock for the whole page rather than one per component.
  • Keep its states and timings as they ship; restyle it through the CSS variables rather than by hand.

Guides

Oxyn · 74 free components · 264 Pro components · 96 screens · 20 blocks · Dioxus and GPUI