Skip to content
UI

Search docs

Search components and documentation

New
Menu

Number Field

A numeric input with decrement/increment steppers, min/max clamping and step.

Quantity: 3 / 10

Installation

npx logic2b@latest add number-field

Usage

import { NumberField } from "@/components/ui/number-field"

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

Controlled:

const [value, setValue] = React.useState(3)

<NumberField value={value} onValueChange={setValue} min={0} max={10} />

It renders a real <input type="number">, so it works with native form submission and keyboard entry; the browser’s own spinners are hidden in favor of the styled buttons, which disable themselves at the min/max bounds.

Examples

Step

API

Prop Type Default
value number — (controlled)
defaultValue number 0
onValueChange (value: number) => void
min number
max number
step number 1
disabled boolean false
…props React.ComponentProps<"input">