Integrated ResearchPicasso
Components

Number input

A number with − / + steppers. For counts and small ranges.

{/* Generated by scripts/build-component-docs.mjs — do not edit. The source is the component folder: guidance.json, the doc block and the props. Change those. */}

A number with − / + steppers. For counts and small ranges.

Import

import { NumberInput } from "@ir/ui";

Props

PropTypeRequiredWhat it does
onValueChange(value: number | null) => voidCalled with the parsed, clamped number — or null when the field is empty.

Do and don't

Use Input with inputMode='numeric'.

Don't — Use it for things that are digits but not quantities — a port, a PIN, a phone number.

Nobody increments a port. Steppers on an identifier invite an off-by-one that looks deliberate.

Set min and max, so the steppers stop and blur clamps.

Don't — Validate the range afterwards with an error message.

A disabled + at the maximum says where the limit is before anyone hits it.

Name the unit in the label — 'Timeout (seconds)'.

Don't — Put the unit in the label only when the value is ambiguous.

3 what? Minutes and seconds differ by 60×, and the steppers make the number look precise.

Accessibility

  • role=spinbutton with aria-valuenow / min / max — what a native number input would announce, without its scroll-wheel and 'e' problems.
  • ArrowUp/Down step, PageUp/Down step ×10, Home/End jump to the bounds.
  • The steppers are tabIndex -1: keyboard users have the arrows, and two extra tab stops per field is a tax on every form.

Where it is drawn

Figma — structure from figma, measurements from figma.

Open in Storybook

On this page