tapcn
Components

Stepper

A numeric stepper control with increment and decrement buttons.

5

Stepper

A numeric stepper control with increment (+) and decrement (-) buttons. Supports configurable min/max bounds, step size, and three size variants.

Installation

npx @tapcn/cli add stepper

Or using shadcn directly:

npx shadcn@latest add https://tapcn.vercel.app/r/stepper.json

Usage

import { useState } from 'react';
import { Stepper } from '~/components/ui/stepper';

export function Example() {
  const [count, setCount] = useState(1);

  return (
    <Stepper
      value={count}
      onValueChange={setCount}
      min={0}
      max={10}
    />
  );
}

With custom step

const [value, setValue] = useState(0);

<Stepper value={value} onValueChange={setValue} step={5} min={0} max={100} />

Size variants

<Stepper value={1} onValueChange={setValue} size="sm" />
<Stepper value={1} onValueChange={setValue} size="default" />
<Stepper value={1} onValueChange={setValue} size="lg" />

Disabled state

<Stepper value={3} onValueChange={() => {}} disabled />

Props

PropTypeDefaultDescription
valuenumber--The current numeric value.
onValueChange(value: number) => void--Callback when the value changes.
minnumber0Minimum allowed value. The decrement button is disabled at this bound.
maxnumber100Maximum allowed value. The increment button is disabled at this bound.
stepnumber1The amount to increment or decrement per press.
disabledbooleanfalseDisables both buttons and reduces opacity.
size"sm" | "default" | "lg""default"Controls the size of the buttons, text, and icons.
classNamestring--Additional NativeWind classes for the outer container.

Accessibility

  • The decrement button has aria-label="Decrease value".
  • The increment button has aria-label="Increase value".
  • The value display uses aria-live="polite" to announce changes to screen readers.

Dependencies

  • icon -- for the plus and minus icons
  • lucide-react-native -- Plus and Minus icons
  • class-variance-authority -- size variant styling

On this page