Skip to main content
.buttonStyle(style: ButtonStyleComponent)
style
ButtonStyleComponent
required
A custom button style component created with defineButtonStyle. The style controls how the button renders in its various states (normal, pressed).

Support

Usage

Apply a custom button style

Button("Tap me", () => handleTap())
    .buttonStyle(
        defineButtonStyle((config) =>
            Text(config.label)
                .padding(12)
                .background(
                    config.isPressed
                        ? Color("gray")
                        : Color("blue")
                )
                .foregroundStyle(Color("white"))
                .cornerRadius(8)
        )
    )

See Also