Forms
Number Input
A number field with step buttons. Up and Down keys change the value too.
ReactVueWeb Components
View in Storybook Playground
Examples
<FormField label="数量"><NumberInput min={0} max={99} defaultValue={1} /></FormField> Props
| Name | Type | Default | Description |
|---|---|---|---|
value | number | null | — | Controlled value (`null` when empty). |
defaultValue | number | null | — | Initial value when uncontrolled. |
onChange | (value: number | null) => void | — | Called with the new value (`null` when cleared). |
min | number | — | Minimum value. |
max | number | — | Maximum value. |
step | number | 1 | Step for the buttons and keyboard. @default 1 |
size | 'sm' | 'md' | 'lg' | md | Control size. @default 'md' |
decrementLabel | string | Decrease | Accessible label for the decrement button. @default 'Decrease' |
incrementLabel | string | Increase | Accessible label for the increment button. @default 'Increase' |
Accessibility
- Body/background contrast is ≥ 7:1 (AAA) in both light and dark.
- Every interaction works with the keyboard alone.
- The focus ring is always visible.
- Respects prefers-reduced-motion and stops excessive motion.
Every component is designed to meet WCAG 2.1 AAA.