Skip to main content
1 of 4
Jeroen
  • 665
  • 6
  • 20

How to get equivalent of "padding" on a button?

I'm using Godot 4. I want to increase the distance between the Button's Text (and possibly icon, later on), and it's outer edges, while keeping the "Colors" options such as "Font Hover Color". The equivalent effect of padding on a CSS styled button.

What I've tried:

I've searched online to find my answer, but that led mostly to different threads about containers, not buttons. Only this rejected GitHub issue to add "Padding" for controls seemed relevant; I think it was rejected mostly because there are already other ways to achieve the effect of paddings? But I can't seem to distill from that thread how to set this up for buttons.

I've gone through all the "Theme Overrides" options in the Godot editor, but only H Separation seemed relevant but that's for space between the icon and text.

I've tried leaving the Button's text empty and creating a child MarginContainer with a child Label but then (a) the button size is nearly zero, plus I worry the "Colors" from the button's theme options won't work.

Bottom line:

How do you set a "padding" (a fixed number of pixels between the edge and contents) of a button in Godot 4?

Jeroen
  • 665
  • 6
  • 20