<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 9.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Stepper",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI7StepperV"
  },
  "title" : "Stepper"
}
-->

# Stepper

A control that performs increment and decrement actions.

```
nonisolated struct Stepper<Label> where Label : View
```

## Overview

Use a stepper control when you want the user to have granular control while
incrementing or decrementing a value. For example, you can use a stepper
to:

- Change a value up or down by `1`.
- Operate strictly over a prescribed range.
- Step by specific amounts over a stepper’s range of possible values.

The example below uses an array that holds a number of [`Color`](/documentation/SwiftUI/Color) values,
a local state variable, `value`, to set the control’s background
color, and title label. When the user clicks or taps the stepper’s
increment or decrement buttons, SwiftUI executes the relevant
closure that updates `value`, wrapping the `value` to prevent overflow.
SwiftUI then re-renders the view, updating the text and background
color to match the current index:

```
struct StepperView: View {
    @State private var value = 0
    let colors: [Color] = [.orange, .red, .gray, .blue,
                           .green, .purple, .pink]

    func incrementStep() {
        value += 1
        if value >= colors.count { value = 0 }
    }

    func decrementStep() {
        value -= 1
        if value < 0 { value = colors.count - 1 }
    }

    var body: some View {
        Stepper {
            Text("Value: \(value) Color: \(colors[value].description)")
        } onIncrement: {
            incrementStep()
        } onDecrement: {
            decrementStep()
        }
        .padding(5)
        .background(colors[value])
    }
}
```

![A view displaying a stepper that uses a text view for stepper’s title and that changes the background color of its view when incremented or decremented. The view selects the new background color from a predefined array of colors using the stepper’s value as the index.](images/com.apple.SwiftUI/SwiftUI-Stepper-increment-decrement-closures@2x.png)

The following example shows a stepper that displays the effect of
incrementing or decrementing a value with the step size of `step` with
the bounds defined by `range`:

```
struct StepperView: View {
    @State private var value = 0
    let step = 5
    let range = 1...50

    var body: some View {
        Stepper(
            value: $value,
            in: range,
            step: step
        ) {
            Text("Current: \(value) in \(range.description) " +
                 "stepping by \(step)")
        }
        .padding(10)
    }
}
```

![A view displaying a stepper with a step size of five, and a prescribed range of 1 though 50.](images/com.apple.SwiftUI/SwiftUI-Stepper-value-step-range@2x.png)

## Topics

### Creating a stepper

[`init(value:step:label:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(value:step:label:onEditingChanged:))

Creates a stepper configured to increment or decrement a binding to a
value using a step value you provide.

[`init(value:step:format:label:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(value:step:format:label:onEditingChanged:))

Creates a stepper configured to increment or decrement a binding to a
value using a step value you provide, displaying its value with an
applied format style.

[`init(_:value:step:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(_:value:step:onEditingChanged:))

Creates a stepper with a title key and configured to increment and
decrement a binding to a value and step amount you provide.

[`init(_:value:step:format:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(_:value:step:format:onEditingChanged:))

Creates a stepper with a title key and configured to increment and
decrement a binding to a value and step amount you provide,
displaying its value with an applied format style.

### Creating a stepper over a range

[`init(value:in:step:label:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(value:in:step:label:onEditingChanged:))

Creates a stepper configured to increment or decrement a binding to a
value using a step value and within a range of values you provide.

[`init(value:in:step:format:label:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(value:in:step:format:label:onEditingChanged:))

Creates a stepper configured to increment or decrement a binding to a
value using a step value and within a range of values you provide,
displaying its value with an applied format style.

[`init(_:value:in:step:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(_:value:in:step:onEditingChanged:))

Creates a stepper instance that increments and decrements a binding to
a value, by a step size and within a closed range that you provide.

[`init(_:value:in:step:format:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(_:value:in:step:format:onEditingChanged:))

Creates a stepper instance that increments and decrements a binding to
a value, by a step size and within a closed range that you provide,
displaying its value with an applied format style.

### Creating a stepper with change behavior

[`init(label:onIncrement:onDecrement:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(label:onIncrement:onDecrement:onEditingChanged:))

Creates a stepper instance that performs the closures you provide when
the user increments or decrements the stepper.

[`init(_:onIncrement:onDecrement:onEditingChanged:)`](/documentation/SwiftUI/Stepper/init(_:onIncrement:onDecrement:onEditingChanged:))

Creates a stepper that uses a title key and executes the closures
you provide when the user clicks or taps the stepper’s increment and
decrement buttons.

### Deprecated initializers

[`init(value:step:onEditingChanged:label:)`](/documentation/SwiftUI/Stepper/init(value:step:onEditingChanged:label:))

Creates a stepper configured to increment or decrement a binding to a
value using a step value you provide.

[`init(value:in:step:onEditingChanged:label:)`](/documentation/SwiftUI/Stepper/init(value:in:step:onEditingChanged:label:))

Creates a stepper configured to increment or decrement a binding to a
value using a step value and within a range of values you provide.

[`init(onIncrement:onDecrement:onEditingChanged:label:)`](/documentation/SwiftUI/Stepper/init(onIncrement:onDecrement:onEditingChanged:label:))

Creates a stepper instance that performs the closures you provide when
the user increments or decrements the stepper.



---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)