---
title: "buttonRepeatBehavior(_:)"
framework: swiftui
role: symbol
role_heading: Instance Method
path: "swiftui/view/buttonrepeatbehavior(_:)"
---

# buttonRepeatBehavior(_:)

Sets whether buttons in this view should repeatedly trigger their actions on prolonged interactions.

## Declaration

```swift
nonisolated func buttonRepeatBehavior(_ behavior: ButtonRepeatBehavior) -> some View

```

## Parameters

- `behavior`: A value of enabled means that buttons should enable repeating behavior and a value of disabled means that buttons should disallow repeating behavior.

## Discussion

Discussion Apply this to buttons that increment or decrement a value or perform some other inherently iterative operation. Interactions such as pressing-and-holding on the button, holding the button’s keyboard shortcut, or holding down the space key while the button is focused will trigger this repeat behavior. Button {     playbackSpeed.advance(by: 1) } label: {     Label("Speed up", systemImage: "hare") } .buttonRepeatBehavior(.enabled) This affects all system button styles, as well as automatically affects custom ButtonStyle conforming types. This does not automatically apply to custom PrimitiveButtonStyle conforming types, and the EnvironmentValues.buttonRepeatBehavior value should be used to adjust their custom gestures as appropriate.

## See Also

### Creating buttons

- [Button](swiftui/button.md)
- [buttonStyle(_:)](swiftui/view/buttonstyle(_:).md)
- [buttonBorderShape(_:)](swiftui/view/buttonbordershape(_:).md)
- [ButtonBorderShape](swiftui/buttonbordershape.md)
- [ButtonRepeatBehavior](swiftui/buttonrepeatbehavior.md)
- [buttonRepeatBehavior](swiftui/environmentvalues/buttonrepeatbehavior.md)
- [buttonSizing(_:)](swiftui/view/buttonsizing(_:).md)
- [ButtonSizing](swiftui/buttonsizing.md)
- [ButtonRole](swiftui/buttonrole.md)
