//
A numeric input field.
bun add xiod-ui1import {2 NumberField,3 NumberFieldDecrement,4 NumberFieldGroup,5 NumberFieldIncrement,6 NumberFieldInput,7 NumberFieldScrubArea8} from "xiod-ui/number-field";1<NumberField>2 <NumberFieldInput />3 <NumberFieldGroup>4 <NumberFieldDecrement />5 <NumberFieldIncrement />6 <NumberFieldScrubArea />7 </NumberFieldGroup>8</NumberField>| Prop | Type | Default | Description |
|---|---|---|---|
id | string| undefined | - | The id of the input element. |
min | number| undefined | - | The minimum value of the input element. |
max | number| undefined | - | The maximum value of the input element. |
allowOutOfRange | boolean| undefined | false | When true, direct text entry may be outside the `min`/`max` range without clamping, so native range underflow/overflow validation can occur. Step-based interactions (keyboard arrows, buttons, wheel, scrub) still clamp. |
smallStep | number| undefined | 0.1 | The small step value of the input element when incrementing while the alt key is held. Snaps to multiples of this value when `snapOnStep` is enabled. |
step | number| "any"| undefined | 1 | Amount to increment and decrement with the buttons and arrow keys, or to scrub with pointer movement in the scrub area. To always enable step validation on form submission, specify the `min` prop explicitly in conjunction with this prop. Specify `step="any"` to always disable step validation; interactive stepping then uses a base amount of `1`, while the alt and shift keys still step by `smallStep` and `largeStep`. |
largeStep | number| undefined | 10 | The large step value of the input element when incrementing while the shift key is held. Snaps to multiples of this value when `snapOnStep` is enabled. |
required | boolean| undefined | false | Whether the user must enter a value before submitting a form. |
disabled | boolean| undefined | false | Whether the component should ignore user interaction. |
readOnly | boolean| undefined | false | Whether the user should be unable to change the field value. |
name | string| undefined | - | Identifies the field when a form is submitted. |
form | string| undefined | - | Identifies the form that owns the hidden input. Useful when the number field is rendered outside the form. |
value | number| null| undefined | - | The raw numeric value of the field. |
defaultValue | number| undefined | - | The uncontrolled value of the field when it's initially rendered. To render a controlled number field, use the `value` prop instead. |
allowWheelScrub | boolean| undefined | false | Whether to allow the user to scrub the input value with the mouse wheel while focused and hovering over the input. |
snapOnStep | boolean| undefined | false | Whether the value should snap to the nearest step when incrementing or decrementing. |
format | NumberFormatOptions| undefined | - | Options to format the input value. |
onValueChange | ((value: number| null, eventDetails: NumberFieldRootChangeEventDetails) => void)| undefined | - | Callback fired when the number value changes. The `eventDetails.reason` indicates what triggered the change: - `'input-change'` for parseable typing or programmatic text updates - `'input-clear'` when the field becomes empty - `'input-blur'` when formatting (and clamping, if enabled) occurs on blur - `'input-paste'` for paste interactions - `'keyboard'` for arrow-key/Home/End stepping (typing digits uses `'input-change'`/`'input-clear'`) - `'increment-press'` / `'decrement-press'` for button presses on the increment and decrement controls - `'wheel'` for wheel-based scrubbing - `'scrub'` for scrub area drags |
onValueCommitted | ((value: number| null, eventDetails: NumberFieldRootCommitEventDetails) => void)| undefined | - | Callback function that is fired when the value is committed. It runs later than `onValueChange`, when: - The input is blurred after typing a value. - The pointer is released after scrubbing or pressing the increment/decrement buttons. It runs simultaneously with `onValueChange` when interacting with the keyboard or the mouse wheel. **Warning**: This is a generic event not a change event. |
locale | LocalesArgument | - | The locale of the input element. Defaults to the user's runtime locale. |
inputRef | Ref<HTMLInputElement>| undefined | - | A ref to access the hidden input element. |
style | CSSProperties| ((state: NumberFieldRootState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
className | string| ((state: NumberFieldRootState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, NumberFieldRootState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
size | "default"| "sm"| "lg"| undefined | default |
| Prop | Type | Default | Description |
|---|---|---|---|
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: NumberFieldDecrementState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, NumberFieldDecrementState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: NumberFieldDecrementState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
className | string| ((state: NumberFieldGroupState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, NumberFieldGroupState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: NumberFieldGroupState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
nativeButton | boolean| undefined | true | Whether the component renders a native `<button>` element when replacing it via the `render` prop. Set to `false` if the rendered element is not a button (for example, `<div>`). |
className | string| ((state: NumberFieldIncrementState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, NumberFieldIncrementState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: NumberFieldIncrementState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
aria-roledescription | string| undefined | 'Number field' | A user-friendly description of the input's role for assistive tech. This is a role description, not an accessible name — use `Field.Label` or `aria-label` to name the control. |
className | string| ((state: NumberFieldInputState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, NumberFieldInputState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: NumberFieldInputState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
| Prop | Type | Default | Description |
|---|---|---|---|
direction | "horizontal"| "vertical"| undefined | 'horizontal' | Cursor movement direction in the scrub area. |
pixelSensitivity | number| undefined | 2 | Determines how many pixels the cursor must move before the value changes. A higher value will make scrubbing less sensitive. |
teleportDistance | number| undefined | - | If specified, determines the distance that the cursor may move from the center of the scrub area before it will loop back around. |
className | string| ((state: NumberFieldScrubAreaState) => string| undefined)| undefined | - | CSS class applied to the element, or a function that returns a class based on the component's state. |
render | ReactElement<unknown, string| JSXElementConstructor<any>>| ComponentRenderFn<HTMLProps, NumberFieldScrubAreaState>| undefined | - | Allows you to replace the component's HTML element with a different tag, or compose it with another component. Accepts a `ReactElement` or a function that returns the element to render. |
style | CSSProperties| ((state: NumberFieldScrubAreaState) => CSSProperties| undefined)| undefined | - | Style applied to the element, or a function that returns a style object based on the component's state. |
labelReq | string | - |