How to resize Tab button

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Alexandr

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

:bust_in_silhouette: Reply From: flurick

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

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

:bust_in_silhouette: Reply From: binogure

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)