In SwiftUI, How do I increase the height of a button?

Solution 1:

You just need to set PlainButtonStyle and draw it as you wish...

Here is for example one of your button:

Button(action: {

}) {
    Text("Singleplayer").font(.system(size: geometry.size.width/20))
        .padding()
        .background(RoundedRectangle(cornerRadius: 8).fill(Color.blue))
        .frame(minWidth: geometry.size.width/2)
}
.buttonStyle(PlainButtonStyle())

custom button

Solution 2:

Use simpler initializer if you need only a title for your Button:

Button("Click me") {
    // Perform action here
}
.frame(width: 100, height: 100)
.background(Color.yellow)

Preview

Note that frame modifier must come before background to make it looks larger. Otherwise, you can't see the difference.

Solution 3:

Please try below Code:

Button(action: {
       //do action       
}) {
    Text("SIGN IN")
        .frame(width: 200 , height: 50, alignment: .center)
        //You need to change height & width as per your requirement
}
 .background(Color.blue)
 .foregroundColor(Color.white)
 .cornerRadius(5)

Output enter image description here