Quantity Stepper
InputMITIncrement / decrement quantity control with min/max clamping and keyboard support.
bun add @otfdashkit/ui
Preview
Quantity StepperInput
Loading Storybook preview…
Code
@otfdashkit/uiimport { useState } from 'react'
import { QuantityStepper } from '@otfdashkit/ui'
export function Example() {
const [qty, setQty] = useState(1)
return (
<div className="flex flex-col items-center gap-3">
<QuantityStepper value={qty} onValueChange={setQty} />
<p className="font-mono text-xs text-muted-foreground">qty: {qty}</p>
</div>
)
}
Free with the SDK. This component ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the QuantityStepper source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| aria-label | string | 'Quantity' | |
| defaultValue | number | (readonly string[] & number) | 1 | Uncontrolled initial quantity. Default 1. |
| disabled | boolean | false | |
| max | number | 99 | Maximum (increment disables here). Default 99. |
| min | number | 1 | Minimum (decrement disables here). Default 1. |
| onValueChange | (value: number) => void | Fires with the clamped next quantity. | |
| size | 'sm' | 'md' | 'md' | Control size. Default 'md'. |
| step | number | 1 | Increment/decrement step. Default 1. |
| value | number | Controlled quantity. |