SwiftUI Picker layout under MacOS26

Prior to MacOS 26, Multiple Pickers could be laid out with a uniform width. For example:

struct LayoutExample: View {
	
	let fruits = ["apple", "banana", "orange", "kiwi"]
	let veg = ["carrot", "cauliflower", "peas", "Floccinaucinihilipilification Cucurbitaceae"]
	@State private var selectedFruit: String = "kiwi"
	@State private var selectedVeg: String = "carrot"
	
	var body: some View {
		VStack(alignment: .leading) {
			Picker(selection: $selectedFruit) {
				ForEach(fruits, id: \.self, content: Text.init)
			} label: {
				Text("Fruity choice")
					.frame(width: 150, alignment: .trailing)
			}
			.frame(width: 300)
		
			Picker(selection: $selectedVeg) {
				ForEach(veg, id: \.self, content: Text.init)
			} label: {
				Text("Veg")
					.frame(width: 150, alignment: .trailing)
			}
			.frame(width: 300)
		}
	}
}

Renders like this, prior to MacOS26:

But now looks like this under MacOS 26:

Is there anyway to control the size of the picker selection in MacOS 26?

Answered by peggers123 in 859515022

The solution is to use buttonSizing(.flexible) as follows:

Picker(selection: $selectedFruit) {
    ForEach(fruits, id: \.self, content: Text.init)
} label: {
    Text("Fruity choice")
        .frame(width: 150, alignment: .trailing)
}
.frame(width: 300)
.buttonSizing(.flexible)
Accepted Answer

The solution is to use buttonSizing(.flexible) as follows:

Picker(selection: $selectedFruit) {
    ForEach(fruits, id: \.self, content: Text.init)
} label: {
    Text("Fruity choice")
        .frame(width: 150, alignment: .trailing)
}
.frame(width: 300)
.buttonSizing(.flexible)
SwiftUI Picker layout under MacOS26
 
 
Q