Number field
React componentCollect a numeric value with step and range constraints.
Try it out
Use the live controls or open the Code tab to view and copy the example.
API reference
Generated from the package’s TypeScript exports. Standard React event and ARIA attributes are also accepted where the component wraps a native element.
| Prop | Type | Description |
|---|---|---|
prefix | ReactNode | See the typed definition and working example for this option. |
suffix | ReactNode | See the typed definition and working example for this option. |
onValueChange | ((value: string) => void) | undefined | Called with the next value. Update controlled state here. |
disabled | boolean | undefined | Disables interaction (or date matchers for DatePicker). |
name | string | undefined | Field name used in form submission. |
type | HTMLInputTypeAttribute | undefined | Standard React / HTML attribute passed to the underlying element. |
value | string | number | readonly string[] | undefined | Controlled value. Pair with its change callback. |
defaultChecked | boolean | undefined | Standard React / HTML attribute passed to the underlying element. |
defaultValue | string | number | readonly string[] | undefined | Initial value for uncontrolled usage. |
className | string | undefined | Additional CSS class names. |
id | string | undefined | Standard React / HTML attribute passed to the underlying element. |
style | CSSProperties | undefined | Inline styles, including CSS custom property overrides. |
rel | string | undefined | Standard React / HTML attribute passed to the underlying element. |
children | ReactNode | Content rendered inside the component. |
onFocus | FocusEventHandler<HTMLInputElement> | undefined | Standard React / HTML attribute passed to the underlying element. |
onBlur | FocusEventHandler<HTMLInputElement> | undefined | Standard React / HTML attribute passed to the underlying element. |
onChange | ChangeEventHandler<HTMLInputElement, HTMLInputElement> | undefined | Standard React / HTML attribute passed to the underlying element. |
onError | ReactEventHandler<HTMLInputElement> | undefined | Standard React / HTML attribute passed to the underlying element. |
onClick | MouseEventHandler<HTMLInputElement> | undefined | Standard React / HTML attribute passed to the underlying element. |
alt | string | undefined | Standard React / HTML attribute passed to the underlying element. |
autoComplete | HTMLInputAutoCompleteAttribute | undefined | Standard React / HTML attribute passed to the underlying element. |
checked | boolean | undefined | Standard React / HTML attribute passed to the underlying element. |
height | string | number | undefined | Standard React / HTML attribute passed to the underlying element. |
max | string | number | undefined | Standard React / HTML attribute passed to the underlying element. |
maxLength | number | undefined | Standard React / HTML attribute passed to the underlying element. |
min | string | number | undefined | Standard React / HTML attribute passed to the underlying element. |
minLength | number | undefined | Standard React / HTML attribute passed to the underlying element. |
placeholder | string | undefined | Standard React / HTML attribute passed to the underlying element. |
readOnly | boolean | undefined | Standard React / HTML attribute passed to the underlying element. |
required | boolean | undefined | Participates in native form validation. |
src | string | undefined | Standard React / HTML attribute passed to the underlying element. |
step | string | number | undefined | Standard React / HTML attribute passed to the underlying element. |
width | string | number | undefined | Standard React / HTML attribute passed to the underlying element. |
labelRequired | string | A meaningful visible or accessible label. |
description | string | undefined | Supporting instructions associated with the control. |
error | string | undefined | Validation message; also sets aria-invalid. |
hideLabel | boolean | undefined | See the typed definition and working example for this option. |
Accessibility & interaction
Use a persistent visible label and provide textual errors; native controls support keyboard input and browser form constraints.
Visible focus, reduced motion, and both color themes are shared across staqui. Choose labels and document structure that make sense in your application; automated checks do not replace assistive-technology testing.
Variants & implementation notes
Native type=number exposes min/max/step and browser steppers. Values emitted by onValueChange remain strings so empty input is representable.
Use the typed API above for the supported variants. The example demonstrates the primary composition; shared controls inherit hover, focus, active and disabled treatment where applicable.