QuantityControl
A compact quantity control with increment/decrement buttons. Shows a trash icon when quantity is at minimum, minus icon otherwise.
Usage
import { QuantityControl } from "@desk/ui/components/quantity-control";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 a controlled display — pass the current
valueand update it inonIncrement/onDecrement; the buttons carry their own a11y labels.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| disabled | boolean | undefined | Whether the control is disabled | |
| max | number | undefined | Maximum value (defaults to 99) | |
| min | number | undefined | Minimum value (defaults to 1) | |
| onDecrement | () => void | Called when decrement button is clicked (when value > 1) | |
| onIncrement | () => void | Called when increment button is clicked | |
| onRemove | (() => void) | undefined | Called when remove button is clicked (when value = 1). If not provided, onDecrement is called instead. | |
| radius | "rounded" | "full" | undefined | Border radius style | |
| testId | string | undefined | Test ID for the quantity display | |
| value | number | Current quantity value |
Composition
Builds on