ButtonRole

A value that describes the purpose of a button.

StructureiOS 15.0+macOS 12.0+tvOS 15.0+watchOS 8.0+ButtonRole in SwiftUI

Declaration

React
type ButtonRole = 'cancel' | 'close' | 'confirm' | 'destructive';
Swift
struct ButtonRole

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

Type properties

Overview

A button role provides a description of a button's purpose. For example, the ButtonRole.destructive role indicates that a button performs a destructive action, like delete user data:

Button("Delete", role: .destructive) { delete() }

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

Used by

See also

More in Other values.