Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Quantity Stepper

ProNew

A quantity control whose number slides in the direction of the change, stops at the stock limit, and turns its minus into Remove at one.

Installation

pnpm dlx shadcn@latest add @viewport/quantity-stepper

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
value*number—
onValueChange*(value: number) => void—
label*string

What is being counted, e.g. "Quantity of Morning mug". It names the group for screen readers.

—
minnumber1
maxnumber99
onRemove() => void

At the minimum, turn the minus into a remove button that calls this.

—
size"sm" | "md""md"
disabledboolean—
classNamestring—

Accessibility

  • A named group; the quantity is an output announced as it changes.
  • Buttons are named and disable at the limits rather than doing nothing.
  • Respects prefers-reduced-motion.