Pricing

Input Number

A number input component with increment and decrement buttons for numeric data entry.

Use the buttons or type to adjust the quantity.

import { Field, FieldDescription, FieldLabel } from "@/components/ui/field"
import { InputNumber } from "@/components/ui/input-number"

export function InputNumberDemo() {
  return (

Installation

pnpm slabui add input-number

Usage

import { InputNumber } from "@/components/ui/input-number"
<InputNumber />

API Reference

InputNumber

A numeric input component with increment and decrement buttons.

PropTypeDefaultDescription
valuenumber | stringControlled value of the input
defaultValuenumberInitial value of the input
multiplenumber1Step value for increment/decrement operations
negativebooleanfalseWhether to allow negative numbers
editablebooleantrueWhether the input can be manually edited
disabledbooleanfalseWhether the input is disabled
variant"outline" | "default" | "blend""outline"Visual style of the component
size"default" | "sm" | "lg""default"Size of the input and buttons
invalidbooleanfalseWhether the input is in an invalid state
delaynumber800Delay in milliseconds before validating input changes
onChange(value, numericValue) => voidCallback fired when the value changes
<InputNumber
  defaultValue={10}
  multiple={5}
  negative={true}
  variant="outline"
  onChange={(value, numericValue) => console.log(numericValue)}
/>