# Stepper

> Molecule — orn-ui

> ⚠️ Requires <UIProvider>: This component (like every orn-ui component) must render inside a <UIProvider> ancestor, or it throws at runtime. See https://orn-ui-docs.vercel.app/getting-started.md

> Runs on Expo SDK 54, 55, 56 and 57, and on bare React Native >=0.81 with react >=19.1. No native modules — works in Expo Go, no prebuild.

## Installation

Install just this component (copies the source into your project, no npm dependency)
```bash
npx orn-ui add stepper
```

Or install the whole package and import it
```tsx
pnpm add orn-ui
import { Stepper } from 'orn-ui/stepper';
```

Depends on: core (theme + icons)

## Variants

### size="md"

```tsx
<Stepper
  value={qty}
  onChangeText={setQty}
  onIncrement={() => setQty((q) => String(Number(q) + 1))}
  onDecrement={() => setQty((q) => String(Math.max(0, Number(q) - 1)))}
/>
```

### size="sm"

```tsx
<Stepper
  value={qtySmall}
  onChangeText={setQtySmall}
  onIncrement={() => setQtySmall((q) => String(Number(q) + 1))}
  onDecrement={() => setQtySmall((q) => String(Math.max(0, Number(q) - 1)))}
  size="sm"
/>
```

## Full demo source

```tsx
const variants: VariantDef[] = [
  {
    label: 'size="md"',
    content: (
      <Stepper
        value={qty}
        onChangeText={setQty}
        onIncrement={() => setQty((q) => String(Number(q) + 1))}
        onDecrement={() => setQty((q) => String(Math.max(0, Number(q) - 1)))}
      />
    ),
  },
  {
    label: 'size="sm"',
    content: (
      <Stepper
        value={qtySmall}
        onChangeText={setQtySmall}
        onIncrement={() => setQtySmall((q) => String(Number(q) + 1))}
        onDecrement={() => setQtySmall((q) => String(Math.max(0, Number(q) - 1)))}
        size="sm"
      />
    ),
  },
];
return <VariantList variants={variants} />;
```

## Props

| Name | Type | Default | Description |
|---|---|---|---|
| `value` | `string` | — | — |
| `onChangeText` | `(text: string) => void` | — | — |
| `onIncrement` | `() => void` | — | — |
| `onDecrement` | `() => void` | — | — |
| `size?` | `'sm' \| 'md' \| 'lg'` | md | Scale of the control: height, buttons, icon and typography. |
| `block?` | `boolean` | false | Takes up all available width and the input absorbs the extra space. |
| `editable?` | `boolean` | true | When false the value can only be changed with the buttons: the keyboard doesn't open and the field loses the background that marks it as editable. |
| `min?` | `number` | — | Minimum allowed value. Disables "-" when reached and clamps the typed value on blur. Negative values are only accepted if `min` is negative. |
| `max?` | `number` | — | Maximum allowed value. Disables "+" when reached and clamps the typed value. |
| `allowDecimals?` | `boolean` | false | Accepts a decimal separator, normalizing comma to dot. |
| `style?` | `StyleProp<ViewStyle>` | — | — |
| `incrementAccessibilityLabel?` | `string` | Increment | — |
| `decrementAccessibilityLabel?` | `string` | Decrement | — |
