Forms
Quantity toggle
A numeric stepper for small counted quantities such as claim line items or dependant counts. Arrow keys step, and values clamp to min and max.
Purpose
Use it for small whole numbers a person adjusts a step at a time. For a wide range where the rough magnitude matters more than the exact figure, use Slider.
Example
States
The bound buttons disable themselves: Decrease at min, Increase at max. The value itself can
never leave the range — every change, typed or stepped, is clamped.
Structure
| Property | Value |
|---|---|
| Buttons | 40px square (size-10), 18px remove / add glyphs |
| Value field | 48px wide (w-12), 14px medium, tabular-nums |
| Border | 1px --input, with internal 1px dividers |
| Radius | --radius-md (6px) |
| Shadow | --shadow-1 |
| Focus | 2px --ring on the focused segment |
| Disabled | 50% opacity container · bound buttons at 40% opacity |
Best practices
Do
- Use it for small counts (roughly 0–20) where stepping is faster than typing.
- Set
minandmaxto the real business limits — the clamp is the validation. - Give each control a meaningful
label("Dependants"), not the default "Quantity".
Accessibility & keyboard
- The container is a
role="group"named by thelabelprop; the value field is arole="spinbutton"carryingaria-valuenow,aria-valueminandaria-valuemax, so screen readers announce both the value and its range. - The stepper buttons carry
aria-label="Decrease"andaria-label="Increase"and disable at the bounds, which is announced. - Typed input is parsed and clamped to
[min, max]; clearing the field resets it tomin. - Keyboard: ArrowUp steps up and ArrowDown steps down by
step, clamped at the bounds; Tab moves between the three segments; digits can be typed directly into the value field.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value | number | undefined | — | Controlled value. |
defaultValue | number | undefined | min | Uncontrolled initial value. |
onValueChange | ((value: number) => void) | undefined | — | — |
min | number | undefined | 0 | — |
max | number | undefined | 99 | — |
step | number | undefined | 1 | — |
disabled | boolean | undefined | — | — |
label | string | undefined | "Quantity" | Accessible name for the control group. |