# macOS + Swift + Xcode: Button label text only partially visible on button

**URL:** <https://forums.swift.org/t/macos-swift-xcode-button-label-text-only-partially-visible-on-button/52147>\
**Category:** Using Swift\
**Tags:** off-topic\
**Created:** [September 17, 2021, 12:51am UTC](https://forums.swift.org/t/macos-swift-xcode-button-label-text-only-partially-visible-on-button/52147 "2021-09-17T00:51:27Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Chris](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@Chris](https://forums.swift.org/u/Chris)\
**Post date:** [September 17, 2021, 12:51am UTC](https://forums.swift.org/t/macos-swift-xcode-button-label-text-only-partially-visible-on-button/52147/1 "2021-09-17T00:51:27Z")

</div>

Hello,

I have a view with a vertical stack, some text and a button. With the current code the top half of the button is cut off. This includes the blue background and the labels text. It is beyond me how to adjust the code to correct this. The view is part of a navigation view that has a frame size of 1200 wide, 900 tall.  
Below is the code in question.

Regards,

Chris

import SwiftUI

struct PrincipalDetailView: View {

```
@EnvironmentObject var viewModel : ViewModel

var body: some View {
    VStack (){
        Text("Update Value Displayed and Hit Return")
            .font(.largeTitle)
            .frame(width: 500, height: 100, alignment: .top)
        
        TextField("Edit Value -> ", text: $viewModel.cellValue)
            .frame(width: 125, height: 50, alignment: .top)
            .font(.system(size: 20, weight: .light))
        
        Spacer()
            .frame(height: 300)
        
        Button(action: {
            viewModel.updateVariables(parameter: "currentView", value: 1)
            viewModel.updateVariables(parameter: "numViews", value: 3)
            viewModel.updateValue(cellId: viewModel.variables[0].cellId, updatedValue: viewModel.cellValue)
        }, label: {
            Text("Update Value")
                .font(.headline)
                .fontWeight(.semibold)
                .foregroundColor(.white)
                .padding()
                .padding(.horizontal, 20)
                .background(
                    Color.blue
                        .cornerRadius(10)
                )
        } )
    }
}

```

}

---

<div class="post-metadata">

**Author:** ![Peter-Schorn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/peter-schorn/32/11183_2.png) [@Peter-Schorn](https://forums.swift.org/u/Peter-Schorn)\
**Post date:** [September 17, 2021, 3:14am UTC](https://forums.swift.org/t/macos-swift-xcode-button-label-text-only-partially-visible-on-button/52147/2 "2021-09-17T03:14:57Z")

</div>

Please make sure all of your code is inside a code fence so that it is easier to read.

The reason the text of the button is getting clipped is because `Button` has a fixed height and you're increasing the size of the view _within_ the button. Apply the `PlainButtonStyle` button modifier to the button:

```swift
Button(action: {
    // ...
}, label: {
    Text("Update Value")
        .font(.headline)
        .fontWeight(.semibold)
        .foregroundColor(.white)
        .padding()
        .padding(.horizontal, 20)
        .background(Color.blue)
        .cornerRadius(10)
})
.buttonStyle(PlainButtonStyle())

```

---

<div class="post-metadata">

**Author:** ![Chris](https://avatars.discourse-cdn.com/v4/letter/c/958977/32.png) [@Chris](https://forums.swift.org/u/Chris)\
**Post date:** [September 20, 2021, 1:41am UTC](https://forums.swift.org/t/macos-swift-xcode-button-label-text-only-partially-visible-on-button/52147/3 "2021-09-20T01:41:03Z")

</div>

Perfect.

Thanks Peter
