Number Field
stableA numeric input with stepper buttons and Intl formatting.
Basic usage
Examples
Quantity selector
A controlled number field used as a cart quantity input.
Quantities and currency
NumberField supports min, max, step and Intl formatting options.
Features
- Min / max / step.
- Keyboard + wheel support.
Installation
bash
pnpm dlx structyl add number-fieldAPI Reference
NumberField.Root
Numeric input with steppers and Intl formatting.
| Prop | Type | Default |
|---|---|---|
| value | numberControlled value. | — |
| defaultValue | numberInitial value when uncontrolled. | — |
| onValueChange | (value?: number) => voidCalled when the value changes. | — |
| min | numberMinimum allowed value. | — |
| max | numberMaximum allowed value. | — |
| step | numberIncrement / decrement amount. | 1 |
| formatOptions | Intl.NumberFormatOptionsNumber formatting options. | — |
| disabled | booleanDisable the field. | false |
NumberField.Input
The text input with role="spinbutton".
| Prop | Type | Default |
|---|
NumberField.IncrementTrigger
Button that increases the value.
| Prop | Type | Default |
|---|
NumberField.DecrementTrigger
Button that decreases the value.
| Prop | Type | Default |
|---|