PrimitiveButtonStyle

A type that applies custom interaction behavior and a custom appearance to all buttons within a view hierarchy.

ProtocoliOS 13.0+macOS 10.15+tvOS 13.0+watchOS 6.0+PrimitiveButtonStyle in SwiftUI

Declaration

React
type PrimitiveButtonStyle =
  | 'automatic'
  | 'bordered'
  | 'borderedProminent'
  | 'borderless'
  | 'glass'
  | 'glassProminent'
  | 'plain'
  | { glass: Glass; }
  | BorderedButtonStyle
  | BorderedProminentButtonStyle
  | BorderlessButtonStyle
  | DefaultButtonStyle
  | GlassButtonStyle
  | GlassProminentButtonStyle
  | PlainButtonStyle;
Swift
@MainActor @preconcurrency protocol PrimitiveButtonStyle

Pass a literal, or build one with SwiftUI.PrimitiveButtonStyle from import { SwiftUI } from 'swiftui-react-native'.

Type properties

Type methods

Overview

To configure the current button style for a view hierarchy, use the View.buttonStyle(_:) modifier. Specify a style that conforms to PrimitiveButtonStyle to create a button with custom interaction behavior. To create a button with the standard button interaction behavior defined for each platform, use ButtonStyle instead.

A type conforming to this protocol inherits @preconcurrency @MainActor isolation from the protocol if the conformance is included in the type's base declaration:

struct MyCustomType: Transition {
    // `@preconcurrency @MainActor` isolation by default
}

Isolation to the main actor is the default, but it's not required. Declare the conformance in an extension to opt out of main actor isolation:

extension MyCustomType: Transition {
    // `nonisolated` by default
}

From Apple’s SwiftUI documentation. Code samples there are Swift.

Used by

See also

More in Styles.