NumberInput
The NumberInput component allows users to enter numeric values. It provides increment and decrement controls and supports formatting, limits, and steps.
Example Usage
Min, Max, and Step
You can constrain the input using min and max props.
The step prop determines the increment/decrement amount.
Formatting
Similar to TextInput, NumberInput supports formatOptions for currencies or percentages.
astro
<NumberInput
id='num-format'
label='Price'
value={100}
formatOptions={{ style: 'currency', currency: 'USD' }}
/> API
| Propiedad | Descripción | Tipo | Por defecto |
|---|---|---|---|
| label | Texto de etiqueta para la entrada | string | |
| min | Valor mínimo | number | |
| max | Valor máximo | number | |
| step | Valor de paso para incrementos/decrementos | number | 1 |
| value | Valor actual | number | |
| formatOptions | Opciones para formatear el valor de la entrada | Intl.NumberFormatOptions | |
| locale | Configuración regional para formatear el valor de la entrada | string | |
| error | Mensaje de error para la entrada | string | boolean |