Number Input

A numeric stepper with minus and plus buttons around a centered input that clamps to min and max and moves by a custom step. Works controlled or uncontrolled.

src/registry/ui/number-input.tsx/r/number-input.json

Installation#

bash
npx shadcn@latest add @minidev/number-input

MiniDev UI is in the shadcn registry directory, so the short form works with no setup. Older CLI versions can use the full URL: npx shadcn@latest add https://ui.minidev.pro/r/number-input.json

Usage#

tsx
import { NumberInput } from "@/components/ui/number-input"

export function Example() {
  return (
    <NumberInput value={n} onChange={setN} aria-label="Number" />
  )
}

API reference#

NumberInput props
PropTypeDefault
valuenumber-
defaultValuenumber0
onChange(value: number) => void-
minnumber-
maxnumber-
stepnumber1
disabledboolean-
classNamestring-
idstring-
aria-labelstring-

Dependencies#

npm

lucide-react

Examples#

All form components

Learn more