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 |