Component
Stepper
A quantity stepper. When the value reaches the minimum and an onRemove handler is set, the minus button becomes a delete action.
2
jsx
const [qty, setQty] = useState(1);
<Stepper
value={qty}
onChange={setQty}
onRemove={() => setQty(0)}
min={1}
max={9}
/>
Props
| Prop | Type | Default | Description |
|---|---|---|---|
value
|
number | — | Current value (controlled). |
onChange
|
(value) => void | — | Called with the next value. |
onRemove
|
() => void | — | When set, the decrement becomes a delete action at the minimum. |
min
|
number | 0 | Minimum value. |
max
|
number | — | Maximum value. |
className
|
string | '' | Extra classes. |