Scaling Labels Within a Container (Preserving Layout)

Godot Version

4.3

Question

Hello everyone,

I’m working on a UI element in Godot and I’m encountering an issue with scaling labels inside a container.

Here’s a visual of my node structure:

Screenshot 2025-01-10 000549

As you can see, I have a TextBox scene that’s structured with a NinePatchRect for the background, a MarginContainer for padding, and a VBoxContainer to organize two labels: Name and Text.

My goal is to scale down only the Name and Text labels while keeping the size and layout of the NinePatchRect, MarginContainer, and overall padding unchanged. I need to avoid adjusting the actual font size because that would affect the text clarity.

The problem is that the scale property on the Label nodes is grayed out, making it seem impossible to achieve.

I’m looking for a way to shrink the visual size of the labels without changing their font size or the surrounding UI elements. Any suggestions on how to achieve this would be greatly appreciated!

Thanks in advance for your help!

Your Label is a child of a Container type node, means you can’t directly set it’s transform values, because it’s controlled by the container. There are 2 ways you can go about it:

  1. Learn how Containers work in Godot, there are many resources on Youtube. Once you get a hang of it, it’s actually pretty useful and easy to use in the future.
  2. Make your Label a child of a Control type node - just put a new Control node between your Label and the VBoxContainer. This will then allow you to directly steer the transform of the Label. It’s tricky to use, because your Control node will still be locked by the Container, but can be use in some specific situations.