Components · Forms

Numeric input

Spin box and slider. One is for entering a number the clinician knows; the other is for exploring a range where the exact value does not matter — and confusing them puts an approximation into a clinical record.

Stable · v1.0 shadcn/ui WCAG 2.2 AA

Overview

A slider is a fast, imprecise, satisfying control. Those first two properties are in tension in clinical software, and precision wins: a value a clinician knows is typed, not dragged towards.

ControlUse whenNever for
Spin box A specific value is being entered or adjusted — a measurement, a threshold, a count Ranges so large that stepping is impractical
Slider A view parameter where feedback is continuous and the exact number does not matter — gain, sweep speed, zoom, playback position Any value that will be recorded
Sliders never enter clinical data

A slider cannot be operated precisely with gloves, on a moving cart, or with a tremor, and it has no state in which it is "unanswered" — it always shows a value, so a form submitted untouched records whatever it happened to be pointing at. Any number that will be stored, trended or acted on is entered as a spin box or text field. Sliders are for view parameters only, where the effect is immediately visible and nothing is written down.

Typed first

Every numeric control accepts a typed value. Steppers assist; they never replace the keyboard.

Never silently changed

No scroll wheel, no drag-past-the-limit, no rounding that happens without saying so.

Unit-bound

The unit is part of the control, visible at all times — the same rule as Key–value pair.

Anatomy

Spin box · slider
mm
0.5–5.0 mm · steps of 0.1 · administrative setting
Display gain
5 mm/mV10 mm/mV20 mm/mV

A view parameter. Nothing is recorded, and the current value is stated on the trace — see ECG review.

Rules

Do
ng/L

Typed, unit-bound, precise. The steppers are a convenience, not the route.

Don't
Peak troponin
03000 ng/L

A recorded clinical value on a slider. Untouched it still reads something, and nobody can hit 1 240 gloved.

Do's and don'ts

Do
ng/L

Typed, unit-bound, precise. Steppers state their increment in the accessible name.

Don't
Peak troponin
03000 ng/L

A recorded clinical value on a slider. Untouched it still reads something, and nobody hits 1 240 gloved.

Accessibility

Outcomes of use

What this contributes to, in the terms of Usability & context of use. These are attributes believed to contribute to an outcome; the outcome itself is settled by observing real use in a specified context, not by this page.

Clinical safety notes

Risk controls carried by this component

Trace these in your risk file (ISO 14971) and usability engineering file (IEC 62366-1).

Implementation

$ npx shadcn@latest add https://md.notjustany.tech/r/numeric-input.json
<SpinBox
  label="Alarm threshold — ST elevation"
  unit="mm"              // required
  min={0.5} max={5.0} step={0.1}
  value={value} onChange={setValue}
/>

<Slider
  label="Display gain"
  unit="mm/mV"
  steps={[5, 10, 20]}      // documented settings, not a continuum
  recorded={false}         // the only permitted value
/>

// Enforced at the component boundary.
if (recorded) {
  throw new Error(
    "[Slider] recorded values cannot be entered on a slider. Use SpinBox."
  )
}
NotJustAnyMed.Tech Design System · Numeric input · v1.0 · draft for review
Covers Spin box and Slider. Reference applications named in this system are fictional; all values shown are fabricated.