+3 votes

How to change the size of these tabs?enter image description here

in Engine by (111 points)

2 Answers

+1 vote

The TabContainer can be styled via:
Custom StyleTag Fg = New StyleBoxLine

And in that style margins can be set per tab:
StyleBoxLineContent Margin

by (911 points)
0 votes

If you don't want to use the margin, and you want, let's say, for example center your button title and having the same size over all other tabs, I created this tiny script:

extends Control


func _ready():
for tab_index in range(0, get_tab_count()):
    var tab_title = get_tab_title(tab_index)

    var tab_name_size = tab_title.length()
    var half_pad = ceil((PADDING_TAB_NAME + tab_name_size) / 2.0)
    var tab_title_padded = '%*s' % [half_pad, tab_title]

    tab_title_padded = '%-*s' % [PADDING_TAB_NAME, tab_title_padded]

    set_tab_title(tab_index, tab_title_padded)
by (69 points)
Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to webmaster@godotengine.org with your username.