numberInput
Prompts the user for a numeric input with optional min/max constraints.
Usage

const age = await io.numberInput({
label: 'Age',
min: 0,
max: 120,
})Props
| Prop | Description | Type | Required | Default |
|---|---|---|---|---|
| label | The label for the number input | string | Yes | — |
| description | The description for the number input | string | No | undefined |
| optional | Whether the number input is optional | boolean | No | false |
| min | The minimum number allowed | number | No | undefined |
| max | The maximum number allowed | number | No | undefined |
| maxRetryAttempts | Maximum retry attempts for invalid input | number | No | 5 |
| validationSchema | Custom validation schema | z.ZodNumber | z.ZodOptional<z.ZodNumber> | No | undefined |
| defaultValue | The default value for the number input | number | No | undefined |
Returns
Returns a Promise<number> or Promise<number | undefined> if optional: true.
Examples
Percentage input

const discount = await io.numberInput({
label: 'Discount Percentage',
min: 0,
max: 100,
description: 'Enter a value between 0 and 100',
defaultValue: 0,
})Optional number

const quantity = await io.numberInput({
label: 'Quantity (optional)',
optional: true,
min: 1,
})