VisorVisor
ComponentsForm

Number Input

A number input with increment/decrement buttons and min/max/step support.

Default

With Step

With Min/Max Bounds

Disabled

Invalid

With Field

Installation

npx visor add number-input

This copies two files into your project:

  • components/ui/number-input/number-input.tsx — the component
  • components/ui/number-input/number-input.module.css — the styles

Usage

import { NumberInput } from '@/components/ui/number-input/number-input';

<NumberInput defaultValue={1} min={0} max={10} />

API Reference

NumberInputProps

PropTypeDefaultDescription
valuenumberControlled numeric value.
defaultValuenumberDefault value for uncontrolled usage.
onChange(value: number | undefined) => voidCallback when the value changes.
minnumberMinimum allowed value.
maxnumberMaximum allowed value.
stepnumber1Increment/decrement step size.
disabledbooleanfalseDisables the number input and buttons.

Accessibility

  • Always provide an aria-label or pair with a <Label> using htmlFor/id — the component has no visible label by default
  • Increment/decrement buttons have aria-label="Increment" and aria-label="Decrement"
  • The input renders as type="text" with inputmode="numeric" for appropriate mobile keyboard
  • Keyboard: Up/Down arrow keys increment/decrement the value; Tab navigates between the input and buttons
  • min/max bounds are enforced both visually (buttons disable at bounds) and on input blur