QuantityControl
A compact quantity control on Base UI NumberField: the quantity is a
number field that Arrow Up/Down step by one, and the buttons repeat while
held. Shows a trash icon when quantity is at minimum and onRemove is set,
minus icon otherwise.
Usage
Best practices
Pass
onRemovewhen hitting the minimum should delete the item - the decrement button then swaps to a trash icon; without it, decrement just stops atmin.It's controlled - pass the current
valueand update it inonIncrement/onDecrement, which fire once per step for clicks, arrow keys and each repeat of a held button. Typing a number is not supported.Tab focuses the quantity itself (the stepper buttons are skipped, as in any number field), announced by its
label. In a list of lines, pass alabelnaming the item so each field is told apart.
Props
Composition
Builds on