NK

Search

Search pages, posts, and components

All components

Number Stepper

Inputs

Quantity stepper whose number pops in the direction it moved.

2

Installation

Add it with the shadcn CLI:

$pnpm dlx shadcn@latest add https://nawalkattel.com.np/r/number-stepper.json
Or install manually
  1. 1. Install dependencies

    pnpm add motion clsx tailwind-merge lucide-react
  2. 2. Copy the component source into components/library/number-stepper.tsx

Props

PropTypeDefaultDescription
valuenumber1Initial value.
minnumber0Lower bound; the minus button disables here.
maxnumber99Upper bound; the plus button disables here.
onChange(value: number) => void - Called with the new value after each step.

Accessibility

  • Both buttons carry aria-labels rather than relying on the icons.
  • Buttons disable at the bounds instead of silently doing nothing.
  • Tabular numerals keep the width stable as digits change.

Dependencies

motionclsxtailwind-mergelucide-react