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
| 속성 | 설명 | 타입 | 기본값 |
|---|---|---|---|
| label | 입력의 레이블 텍스트 | string | |
| min | 최소값 | number | |
| max | 최대값 | number | |
| step | 증가/감소 단계 값 | number | 1 |
| value | 현재 값 | number | |
| formatOptions | 입력 값을 형식화하기 위한 옵션 | Intl.NumberFormatOptions | |
| locale | 입력 값을 형식화하기 위한 로케일 | string | |
| error | 입력의 오류 메시지 | string | boolean |