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
| Eigenschaft | Beschreibung | Typ | Standard |
|---|---|---|---|
| label | Beschriftungstext für die Eingabe | string | |
| min | Minimalwert | number | |
| max | Maximalwert | number | |
| step | Schrittweite für Inkremente/Dekremente | number | 1 |
| value | Aktueller Wert | number | |
| formatOptions | Optionen zur Formatierung des Eingabewerts | Intl.NumberFormatOptions | |
| locale | Gebietsschema zur Formatierung des Eingabewerts | string | |
| error | Fehlermeldung für die Eingabe | string | boolean |