Number Field API
View componentThe full prop reference for the Number Field component. A numeric input with stepper buttons and Intl formatting.
Import
import { NumberField } from '@structyl/styled';Props
Root
Container component that manages number field state and provides context to child components
| Prop | Type | Default |
|---|---|---|
| asChild# | booleanMerge props with immediate child element instead of rendering a div | — |
| value# | number | undefinedControlled numeric value | — |
| defaultValue# | number | undefinedInitial uncontrolled numeric value | — |
| onValueChange# | (value: number | undefined) => voidCallback fired when the numeric value changes | — |
| min# | number | undefinedMinimum allowed value; enforced on all value changes | — |
| max# | number | undefinedMaximum allowed value; enforced on all value changes | — |
| step# | numberAmount to increment/decrement with arrow keys or triggers | 1 |
| disabled# | boolean | undefinedDisables input and trigger buttons | — |
| readOnly# | boolean | undefinedPrevents editing but allows display; triggers remain functional | — |
| formatOptions# | Intl.NumberFormatOptions | undefinedOptions passed to Intl.NumberFormat for display formatting | — |
| locale# | string | undefinedLocale string passed to Intl.NumberFormat for number formatting | — |
| className# | stringCSS class name applied to the root div element | — |
Input
Text input element with role='spinbutton'; forwards all standard HTML input props plus onChange/onKeyDown/onWheel event handlers
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS class name applied to the input element | — |
| onChange# | (event: React.ChangeEvent<HTMLInputElement>) => voidCallback fired on input value change; composed with internal change handler | — |
| onKeyDown# | (event: React.KeyboardEvent<HTMLInputElement>) => voidCallback fired on key down; composed with internal arrow/page/home/end key handlers | — |
| onWheel# | (event: React.WheelEvent<HTMLInputElement>) => voidCallback fired on wheel scroll when focused; composed with internal increment/decrement handler | — |
IncrementTrigger
Button to increase the numeric value by step amount; disabled when value >= max
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS class name applied to the button element | — |
| onClick# | (event: React.MouseEvent<HTMLButtonElement>) => voidCallback fired on button click; composed with internal increment handler | — |
DecrementTrigger
Button to decrease the numeric value by step amount; disabled when value <= min
| Prop | Type | Default |
|---|---|---|
| className# | stringCSS class name applied to the button element | — |
| onClick# | (event: React.MouseEvent<HTMLButtonElement>) => voidCallback fired on button click; composed with internal decrement handler | — |
Source code
If you didn't find what you need here, read the component implementation .