Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make a SwiftUi Button's text larger and/or bold

Tags:

ios

swift

swiftui

Say I have a Button in SwiftUI:

Button("Tap me") {
    print("Button tapped!")
}

How can I can I make the font size of the Button's text larger and bold?

like image 211
Jasjeev Avatar asked Dec 06 '25 15:12

Jasjeev


1 Answers

Use the bold() Text modifier on a Button's label.

Example:

Button {
    print("Button tapped!")
} label: {
    Text("Tap me").bold()
}

To make the text larger and bold, just chain the modifiers:

Button {
    print("Button tapped!")
} label: {
    Text("Tap me")
        .font(.title)
        .bold()
}
like image 97
George Avatar answered Dec 08 '25 22:12

George



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!