Skip to content
OTF Kit logoOTF Kit

Quantity Stepper

Input

Increment / decrement quantity control with min/max clamping and keyboard support.

View in Storybook
Quantity Stepper
Loading Storybook preview…

Installation

bun add @otfdashkit/ui

Usage

Import QuantityStepper from @otfdashkit/ui.

Code
// Quantity Stepper — Increment / decrement quantity control with min/max clamping and keyboard support.
//
// Install:
//   bun add @otfdashkit/ui

import { QuantityStepper } from '@otfdashkit/ui'

export function Example() {
  return (
    <QuantityStepper>
      {/* your content */}
    </QuantityStepper>
  )
}

Props

Props declared in the QuantityStepper source. Inherited HTML attributes are not listed.

PropTypeDefaultDescription
aria-labelstring'Quantity'
defaultValuenumber | (readonly string[] & number)1Uncontrolled initial quantity. Default 1.
disabledbooleanfalse
maxnumber99Maximum (increment disables here). Default 99.
minnumber1Minimum (decrement disables here). Default 1.
onValueChange(value: number) => voidFires with the clamped next quantity.
size'sm' | 'md''md'Control size. Default 'md'.
stepnumber1Increment/decrement step. Default 1.
valuenumberControlled quantity.

Related