# Stepper Button

> An add-to-cart button that reshapes into a quantity stepper in the same pill.

## Spec sheet

| | |
| --- | --- |
| Access | Free: no account, free for commercial use |
| Shelf | Components › Buttons |
| Live preview | https://uibrik.com/components/stepper-button |
| Writes | 1 file into `components/uibrik/stepper-button/` |
| Packages | `@number-flow/react`, `@tabler/icons-react`, `motion`, `react-use-measure` (the CLI installs them) |
| Needs | React 19, Tailwind CSS v4, a project set up with `npx shadcn@latest init` |
| Theme | Reads the shadcn tokens and follows class-based dark mode ([theming](https://uibrik.com/docs/theming.md)) |
| Updated | Nov 9, 2026 |

## Add it

```bash
npx shadcn@latest add https://uibrik.com/r/stepper-button.json
```

With the `@uibrik` namespace in `components.json` ([setup](https://uibrik.com/docs/installation.md)): `npx shadcn@latest add @uibrik/stepper-button`.

Can't run commands? https://uibrik.com/components/stepper-button/prompt.txt has every file verbatim, with the setup steps, ready for an assistant to write.

## Render it

Renders as is; every value shown is the default, so delete any line you don't need.

```tsx
import { StepperButton } from "@/components/uibrik/stepper-button/stepper-button";

<StepperButton
  label="Add to cart"
  max={9}
  variant="solid"
  size="md"
  trashAtOne
  radius={12}
  defaultValue={0}
  onChange={(quantity) => {}}
/>
```

## Tune it

The same props as the Customize panel on https://uibrik.com/components/stepper-button.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `label` | `string` | `"Add to cart"` | Button text. |
| `max` | `number` | `9` | Highest quantity allowed. |
| `variant` | `"solid" \| "soft" \| "outline"` | `"solid"` | Primary, or a quieter look. |
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | Height, padding and text size. |
| `trashAtOne` | `boolean` | `true` | At one, show a trash icon in place of minus, since the next tap removes it. |
| `radius` | `number` | `12` | Corner radius. |

## Wire it

The props the Customize panel doesn't show: ranges, data, content and callbacks.

| Prop | Type | Default | What it does |
| --- | --- | --- | --- |
| `defaultValue` | `number` | `0` | Starting quantity. 0 shows the add button. |
| `onChange` | `(quantity: number) => void` |  | Called with the new quantity after each change. |
| `className` | `string` |  | Classes for the wrapper. |

## Where it fits

- **Add to cart**: An add button reshaping into a quantity stepper in the same pill saves space. Pairs with [Cart Flight](https://uibrik.com/components/cart-flight.md) (Pro).
- **Grocery and food apps**: Adjusting quantity right on the product card speeds up ordering.
- **Ticket quantities**: The same pill works for seats and tickets.

## Same shelf: Buttons

- [Tactile Toggle](https://uibrik.com/components/tactile-toggle.md): A single switch whose knob squishes under the finger, drags like the real thing and springs home on release.
- [Theme Switch](https://uibrik.com/components/theme-switch.md): Switches the page theme: the sun pulls in its rays and is eclipsed into a moon while the new theme spreads out from the button.
- [Announcement Pill](https://uibrik.com/components/announcement-pill.md): A small New pill for above a hero heading, with a band of light along its border and an arrow that grows on hover.
- [Balloon Button](https://uibrik.com/components/balloon-button.md): An inflated, half-balloon button drawn with a WebGL shader, with folds along its seam and a springy dent when pressed.
- [Bookmark Button](https://uibrik.com/components/bookmark-button.md): A save button whose bookmark fills from the top like a dropped ribbon while the label rolls to Saved.
- [Chain Copy](https://uibrik.com/components/chain-copy.md): A copy-link button whose chain icon snaps apart when pressed, flings two chips from the break, then swings back together and relinks as the label rolls to Copied.

## Ground rules

- Only the props above exist. To change anything else, edit the installed file.
- Keep the files in `components/uibrik/stepper-button/` so the import paths keep resolving.
- The playbook for working with the whole library: https://uibrik.com/llms.txt
