Skip to content
Harness Design System Harness Design System Harness Design System

NumberInput

The NumberInput component is used to handle user input, providing options for styling via themes and sizes. The component also offers options for adding icons, captions, custom content, and error text for the field.

Usage

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)}
/>
)

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.

When an error occurs, set theme="danger" and pass the error message to the error prop.

For warnings, set theme="warning" and provide the warning message via the warning prop.

Min / Max limits

Integer / Decimal value

Positive / Negative value

Custom Steppers

With Suffix

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).

API Reference

interface InformerProps extends Omit<TooltipProps, "children"> {
className?: string;
/**
* If disabled, the tooltip will not be shown
*/
disabled?: boolean;
iconProps?: IconPropsV2;
}
Prop
Required
Default
Type
wrapperClassNamefalsestring
labelfalsestring
idfalsestring
disabledfalsefalseboolean
optionalfalsefalseboolean
captionfalsestring
suffixfalseReactNode
errorfalsestring
warningfalsestring
hideStepperfalsefalseboolean
integerOnlyfalsefalseboolean
minfalsenumber
maxfalsenumber
stepfalse1number
placeholderfalsestring
classNamefalsestring
themefalse'default''default' | 'success' | 'danger' | 'warning'
defaultValuefalsenumber
valuefalsenumber
onChangefalseReact.ChangeEventHandler<HTMLInputElement>
sizefalse'md''md' | 'sm'
readOnlyfalsefalseboolean
informerContentfalseExclude<ReactNode, boolean | null | undefined>
informerPropsfalseInformerProps
labelSuffixfalseReactNode
orientationfalse'vertical''vertical' | 'horizontal'