Picker form style without Form

Is it possible to style a Picker on macOS to look like it was in a Form, but without actually being in a grouped Form?

Unfortunately I can't use Form because its style is not customizable enough. I've tried setting various buttonStyles but I only got close to what I want. The biggest problem is that the picker is left-aligned and I need it right-aligned.

Answered by DTS Engineer in 790302022

@mhoeller You could try either using the MenuPickerStyle modifier or you could try using the.multilineTextAlignment(_:) modifier to trailing-align it, or .fixedSize(), which will size the Picker to the size of the value label.

Apart from that, an alternative would be creating a custom picker View which you would have to manually implement.

Could you also file an enhancement request, via Feedback Assistant describing your use case and what you're trying to customize.

@mhoeller You could try either using the MenuPickerStyle modifier or you could try using the.multilineTextAlignment(_:) modifier to trailing-align it, or .fixedSize(), which will size the Picker to the size of the value label.

Apart from that, an alternative would be creating a custom picker View which you would have to manually implement.

Could you also file an enhancement request, via Feedback Assistant describing your use case and what you're trying to customize.

Picker form style without Form
 
 
Q