SetterBar behavior

To keep button size, one option would be to add StringPadRight

SetterBar[1, StringPadRight @ ( StringRepeat["q", #] & /@ Range@5 ), 
Appearance -> {"Vertical", "Button"}]

enter image description here

To diminish margins one possible way is to add "AbuttingLeft", i.e.

 SetterBar[1, StringPadRight @ ( StringRepeat["q", #] & /@ Range@5 ), 
 Appearance -> {"Vertical", "AbuttingLeft"}]

enter image description here

As a trade-off, one more documented option is to use Appearance->"Palette".

enter image description here

Also notice that at my Mac OS with V10.3 "Horizontal" appearance behaves in the same way (with small move of the right side of double-clicked buttons).

enter image description here


For Manipulate it is also possible to use ImageSize and Alignment via Row like so:

Manipulate[s,
{{s, 1}, (# -> 
  Row[{#}, ImageSize -> 39, Alignment -> Center]) & /@ 
 (StringRepeat["q", #] & /@ Range@5), SetterBar, Appearance -> "Vertical"}, 
 ControlPlacement -> Left]

@MichaelE2's warning concerning size parameters applies here as well.


I usually use Pane to solve such alignment problems. String padding in a variable-width font does not produce reliable results, and Pane can be used to get around that. (Fortunately or unfortunately, a vertical SetterBar automatically pads out the buttons to be the same sizes, and I cannot check this on Windows.)

One of the issues is to determine the dimensions to use for Pane. In particular, the width depends on the style in which the SetterBar is ultimately displayed. When the style is unknown, it can be a challenge to get it right. Usually, I don't worry if the dimensions are little too large, and estimate by trial and error. However, sometimes one wants to get it exactly right, or at least exactly the same as something else. For that one can apply Rasterize to the string in the display style.

strings = StringRepeat["q", #] & /@ Range@5;
width = First@Rasterize[#, "BoundingBox"] & /@ strings // Max
(*  39  *)

SetterBar[1, Pane[#, width, Alignment -> Center] & /@ strings, Appearance -> {"Vertical"}]

Mathematica graphics

For another style, do this:

style = "Label";
width = First@Rasterize[Style[#, style], "BoundingBox"] & /@ styledstrings // Max
(*  28  *)

SetterBar[1, Pane[#, width, Alignment -> Center] & /@ strings, Appearance -> {"Vertical"},
 BaseStyle -> style]

Mathematica graphics

For a Manipulate setter bar, use the "ManipulateLabel" style:

style = "ManipulateLabel";
width = First@Rasterize[Style[#, style], "BoundingBox"] & /@ styledstrings // Max
(*  27  *)

Manipulate[
 s,
 {{s, "q"}, # -> Pane[#, width, Alignment -> Center] & /@ strings, 
  SetterBar, Appearance -> {"Vertical"}, ControlPlacement -> Left}
 ]

Mathematica graphics

One can compare the width with the default Manipulate, or with other values for width, with

Grid[List /@ {man1, man2,...}, Spacings -> 0, 
 Dividers -> {{1 -> Thin, 2 -> Thin}, None}]

Below are the widths in the "ManipulateLabel" style of the strings padded with spaces. They vary considerably.

First@Rasterize[Style[#, style], "BoundingBox"] & /@ 
 StringPadRight@(StringRepeat["q", #] & /@ Range@5)
(*  {15, 19, 21, 25, 27}  *)

For a fixed-width font, there is no such problem.

First@Rasterize[#, "BoundingBox"] & /@ 
 StringPadRight@(StringRepeat["q", #] & /@ Range@5)
(*  {39, 39, 39, 39, 39}  *)