Homelogologo
Sponsor

NumberInput

A component that allows users to enter a number and increment or decrement the value.

Usage

A compound component that provides a way to enter and adjust numerical values.

import { NumberInput, Button, Icon } from "@elemnts-ui/react"; <NumberInput.Root defaultValue="10"> <NumberInput.Label>Quantity</NumberInput.Label> <NumberInput.Input /> <NumberInput.Control> <NumberInput.DecrementTrigger asChild> <Button variant="tertiary" size="xs"> <Icon icon="tabler:minus" width="14" height="14" /> </Button> </NumberInput.DecrementTrigger> <NumberInput.IncrementTrigger asChild> <Button variant="tertiary" size="xs"> <Icon icon="tabler:plus" width="14" height="14" /> </Button> </NumberInput.IncrementTrigger> </NumberInput.Control> </NumberInput.Root>;

Min and Max

Use the min and max props to restrict the range of values.

Step

Use the step prop to change the increment/decrement amount.

Scrubber

The NumberInput.Scrubber allows users to change the value by clicking and dragging.

API Reference

NumberInput

The root container for the number input.

PropTypeDefault
allowMouseWheelboolean-
allowOverflowbooleantrue
asChildbooleanfalse
clampValueOnBlurbooleantrue
defaultValuestring-
disabledboolean-
focusInputOnChangebooleantrue
formstring-
formatOptionsNumberFormatOptions-
idstring-
idsPartial<{ root: string; label: string; input: string; incrementTrigger: string; decrementTrigger: string; scrubber: string }>-
inputModeInputMode"decimal"
invalidboolean-
largeStepnumber10 * step
localestring"en-US"
maxnumberNumber.MAX_SAFE_INTEGER
minnumberNumber.MIN_SAFE_INTEGER
namestring-
onFocusChange(details: FocusChangeDetails) => void-
onValueChange(details: ValueChangeDetails) => void-
onValueCommit(details: ValueChangeDetails) => void-
onValueInvalid(details: ValueInvalidDetails) => void-
patternstring"-?[0-9]*(.[0-9]+)?"
readOnlyboolean-
requiredboolean-
smallStepnumberstep / 10
spinOnPressbooleantrue
stepnumber1
translationsIntlTranslations-
valuestring-

NumberInputLabel

The label for the number input.

PropTypeDefault
asChildbooleanfalse

NumberInputControl

The container for the increment and decrement triggers.

PropTypeDefault
asChildbooleanfalse

NumberInputValueText

Displays the formatted value of the number input.

PropTypeDefault
asChildbooleanfalse

NumberInputInput

The input field for the numerical value.

PropTypeDefault
asChildbooleanfalse

NumberInputDecrementTrigger

The button to decrement the value.

PropTypeDefault
asChildbooleanfalse

NumberInputIncrementTrigger

The button to increment the value.

PropTypeDefault
asChildbooleanfalse

NumberInputScrubber

A region that allows users to change the value by dragging.

PropTypeDefault
asChildbooleanfalse