Skip to content
← Inventory

QuantityControl

A compact quantity control with increment/decrement buttons. Shows a trash icon when quantity is at minimum, minus icon otherwise.

2

Usage

import { QuantityControl } from "@desk/ui/components/quantity-control";

Best practices

  • Pass onRemove when hitting the minimum should delete the item — the decrement button then swaps to a trash icon; without it, decrement just stops at min.

  • It's a controlled display — pass the current value and update it in onIncrement/onDecrement; the buttons carry their own a11y labels.

Props

PropTypeDefaultDescription
disabledboolean | undefined

Whether the control is disabled

maxnumber | undefined

Maximum value (defaults to 99)

minnumber | undefined

Minimum value (defaults to 1)

onDecrement(required)() => void

Called when decrement button is clicked (when value > 1)

onIncrement(required)() => 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

testIdstring | undefined

Test ID for the quantity display

value(required)number

Current quantity value

Composition