---
title: "Adaptive Stepper"
description: "Composable numeric stepper whose fixed footprint adapts at its minimum and maximum while the value rolls between steps."
category: "Components"
publishedAt: "2026-08-31"
updatedAt: "2026-11-10"
documentation: "https://beui.dev/components/motion/adaptive-stepper"
markdown: "https://beui.dev/components/motion/adaptive-stepper.md"
license: "MIT"
---

# Adaptive Stepper

> Composable numeric stepper whose fixed footprint adapts at its minimum and maximum while the value rolls between steps.

## Install

```bash
npx shadcn@latest add @beui/adaptive-stepper
```

## Dependencies

- `clsx`
- `lucide-react`
- `motion`
- `react`
- `tailwind-merge`

## Usage

```tsx
"use client";

import {
  AdaptiveStepper,
  AdaptiveStepperDecrement,
  AdaptiveStepperIncrement,
  AdaptiveStepperValue,
} from "@/components/motion/adaptive-stepper";

export function AdaptiveStepperPreview() {
  return (
    <div className="flex min-h-[320px] w-full items-center justify-center px-4">
      <AdaptiveStepper defaultValue={2} min={0} max={3} aria-label="Guests">
        <AdaptiveStepperDecrement />
        <AdaptiveStepperValue />
        <AdaptiveStepperIncrement />
      </AdaptiveStepper>
    </div>
  );
}
```

## API Reference

### AdaptiveStepper

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `value` | `number` |  | No | The current value, for controlled use. |
| `defaultValue` | `number` | `0` | No | The initial value when uncontrolled. Default: 0 |
| `onValueChange` | `((value: number) => void)` |  | No | Called with the new value when a button steps it. |
| `min` | `number` | `0` | No | Lowest allowed value. Default: 0 |
| `max` | `number` | `10` | No | Highest allowed value. Default: 10 |
| `step` | `number` | `1` | No | Amount each press adds or removes. Default: 1 |
| `disabled` | `boolean` | `false` | No | Disables both buttons. Default: false |
| `name` | `string` |  | No | Form field name. Renders a hidden input carrying the value. |
| `formatValueText` | `((value: number) => string)` |  | No | Formats the value read to screen readers. Defaults to a locale number. |
| `className` | `string` |  | No | Classes merged onto the root fieldset. |
| `aria-label` | `string` |  | No | Accessible name for the stepper. Default: "Quantity" |
| `labels` | `Partial<{ label: string; summary: string; decrease: string; increase: string; }>` |  | No | Override any built-in string. `{label}` and `{value}` fill `summary`. |

### AdaptiveStepperDecrement

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `onClick` | `((event: MouseEvent<HTMLButtonElement, MouseEvent>) => void)` |  | No | Called on click before the step. Call `preventDefault()` to skip the step. |
| `ref` | `Ref<HTMLButtonElement>` |  | No | Ref to the underlying button element. |
| `className` | `string` |  | No | Classes merged onto the root element. |

### AdaptiveStepperValue

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `className` | `string` |  | No | Classes merged onto the root element. |

### AdaptiveStepperIncrement

| Prop | Type | Default | Required | Description |
| --- | --- | --- | --- | --- |
| `onClick` | `((event: MouseEvent<HTMLButtonElement, MouseEvent>) => void)` |  | No | Called on click before the step. Call `preventDefault()` to skip the step. |
| `ref` | `Ref<HTMLButtonElement>` |  | No | Ref to the underlying button element. |
| `className` | `string` |  | No | Classes merged onto the root element. |

## About Adaptive Stepper

Adaptive Stepper is a composable numeric stepper for React made of AdaptiveStepper, AdaptiveStepperDecrement, AdaptiveStepperValue and AdaptiveStepperIncrement. Its footprint stays fixed: when the value reaches the minimum or maximum, the unavailable button exits and the value surface expands into its space on a gooey liquid surface. The number rolls up or down between steps with Framer Motion, and min, max and step set the range.

### When to use it

- A shopping cart or checkout needs a quantity selector that cannot go below one.
- A booking form asks for the number of guests, rooms or tickets within a fixed limit.
- A settings panel adjusts a small whole number, such as font size or retry count, with clear bounds.

### Accessibility

The stepper is a fieldset with a hidden legend that reads its label and current value, and the buttons are labelled "Decrease value" and "Increase value" by default. The value is an output element announced through a polite live region, and formatValueText changes what screen readers hear. When a bound hides a button, that button is disabled, removed from the tab order and hidden from assistive technology, and if it was activated from the keyboard, focus moves to the remaining button. With reduced motion enabled, the number changes without rolling and the press and fade effects are instant.

### FAQ

**How do I make a quantity stepper in React?**

Render AdaptiveStepper with AdaptiveStepperDecrement, AdaptiveStepperValue and AdaptiveStepperIncrement as children, and set min, max and step.

**Can I control the stepper value?**

Yes. Pass value and onValueChange for controlled use, or defaultValue for uncontrolled use. Values outside min and max are clamped.

**Can the stepper submit with a form?**

Yes. Set the name prop and it renders a hidden input with the current value.

## Source

- Registry detail: https://beui.dev/r/adaptive-stepper
- Raw source: https://beui.dev/r/adaptive-stepper/raw
- GitHub: https://github.com/starc007/ui-components
