<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 13.0.0 -",
    "visionOS: 1.0.0 -",
    "watchOS: 6.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "SwiftUI",
  "identifier" : "/documentation/SwiftUI/Button/init(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "SwiftUI"
    ],
    "preciseIdentifier" : "s:7SwiftUI6ButtonVA2A09PrimitiveC18StyleConfigurationV5LabelVRszrlEyACyAGGAEcfc"
  },
  "title" : "init(_:)"
}
-->

# init(_:)

Creates a button based on a configuration for a style with a custom
appearance and custom interaction behavior.

```
nonisolated init(_ configuration: PrimitiveButtonStyleConfiguration)
```

## Parameters

`configuration`

A configuration for a style with a custom
appearance and custom interaction behavior.

## Discussion

Use this initializer within the
[`makeBody(configuration:)`](/documentation/SwiftUI/PrimitiveButtonStyle/makeBody(configuration:)) method of a
[`PrimitiveButtonStyle`](/documentation/SwiftUI/PrimitiveButtonStyle) to create an instance of the button that you
want to style. This is useful for custom button styles that modify the
current button style, rather than implementing a brand new style.

For example, the following style adds a red border around the button,
but otherwise preserves the button’s current style:

```
struct RedBorderedButtonStyle: PrimitiveButtonStyle {
    func makeBody(configuration: Configuration) -> some View {
        Button(configuration)
            .border(Color.red)
    }
}
```

---

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)