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} />

Prefix and suffix

Same props, same treatment as Input: a currency symbol before the value, a unit after it, inside the same well as the steppers.

$
h

API Reference

NumberInputProps

PropTypeDefaultDescription
valuenumber—Controlled numeric value.
defaultValuenumber—Default value for uncontrolled usage.
onChange(value: number | undefined) => void—Callback when the value changes.
minnumber—Minimum allowed value.
maxnumber—Maximum 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