Input Number
Ein Zahlenfeld mit Minus- und Plus-Schaltflächen – ein Spinbutton mit Pfeiltasten, Bild auf / ab und Pos1 / Ende, begrenzt auf min und max, als Formularsteuerelement.
Verfügbar für
Angular: verfügbar Vue: verfügbar React: verfügbar React Native: verfügbar
Verwendung
2 × €24.00 = €48.00
<div class="demo-stack" style="max-width: 20rem">
<div soneField>
<label soneFieldLabel for="demo-qty">Quantity</label>
<sone-input-number inputId="demo-qty" [(value)]="qty" [min]="1" [max]="10" />
<p soneFieldDescription>{{ qty() }} × €24.00 = €{{ ((qty() ?? 0) * 24).toFixed(2) }}</p>
</div>
<div soneField>
<label soneFieldLabel for="demo-weight">Weight (kg)</label>
<sone-input-number inputId="demo-weight" size="sm" [(value)]="weight" [min]="0" [step]="0.5" />
</div>
</div>Import
import {
SoneInputNumberComponent,
} from "@surface-one/angular/input-number";API-Referenz
SoneInputNumberComponentKomponente
A number field with − and + buttons — a quantity in a cart, a count in a form. The field is a WAI-ARIA spinbutton: ↑ / ↓ step, Page Up / Page Down step × 10, Home / End jump to `min` / `max`; typed text is parsed and clamped on blur or Enter. A ControlValueAccessor of `number | null`, or `[(value)]`.
| Name | Typ | Standard |
|---|---|---|
valuebidirektional | number | null | null |
min | null | null |
max | null | null |
step | number | 1 |
size | InputNumberSize | "default" |
placeholder | string | "" |
inputId | string | null | null |
ariaLabelThe field's accessible name, when no `<label for>` names it. | string | null | null |
disabled | boolean | false |
invalid | boolean | false |
decrementLabel | — | $localize`:Button that lowers a number field by one step:Decrease` |
incrementLabel | — | $localize`:Button that raises a number field by one step:Increase` |