Skip to content

Number Input

The NumberInput component handles numeric input, providing options for styling via themes and sizes. It also offers options for adding stepper controls, captions, suffixes, tooltips, and error or warning text for the field.

Variations

Disable

Read only

Optional

Without stepper UI

Theme

The NumberInput component accepts a theme prop, which defines the visual state of the input: either success, warning, or danger.

Passing a message to error forces the danger theme, and passing a message to warning forces the warning theme — these override any explicit theme.

Min / Max limits

Integer and decimal values

By default the input accepts decimals. Set integerOnly to block decimal points and restrict entry to whole numbers.

Positive and negative values

Custom steppers

With suffix

With tooltip

tooltipContent is used to display the content of the tooltip. tooltipProps is used to pass additional props to the tooltip.

Orientation

The NumberInput component accepts an optional orientation prop, which defines the layout direction of the input and its label. Available options are horizontal and vertical (default).

Installation

import { NumberInput } from '@harnessio/ui/components'
// ..
return (
<NumberInput
integerOnly
label="Quantity"
placeholder="Enter a number"
min={0}
max={100}
defaultValue={1}
onChange={(e) => handleQuantityChange(e.target.value)}
/>
)