Skip to content

Tabs ​

Путь подключения: require "ProjectMotionUI/Components/Tabs"


Класс PMUI.Tabs ​

Наследуется от: PMUI.BaseElement

Методы и функции ​

PMUI.Tabs:new() ​

Creates a tab container with a tab bar and a content area.

Returns: PMUI.Tabs

PMUI.Tabs:AddTab(title) ​

Adds a new tab and returns its content container. The first tab added is automatically selected.

ПараметрТипОписание
titlestringText displayed on the tab button.

Returns: PMUI.Frame Content container associated with the new tab.

PMUI.Tabs:UpdateTabButtonsLayout() ​

Recalculates tab button positions and widths. All buttons share the available tab bar width equally.

PMUI.Tabs:SelectTab(index, instant) ​

Activates the specified tab and updates the visibility and appearance of all tabs. The selected tab can optionally skip its fade-in animation.

ПараметрТипОписание
indexnumberIndex of the tab to activate.
instantboolean|nilIf true, switches without playing the fade-in animation.

PMUI.Tabs:OnTabChange(callback) ​

Registers a callback invoked whenever the active tab changes. The callback receives the selected tab index and its tab data.

ПараметрТипОписание
callbackfunction|nilTab change callback.

Returns: PMUI.Tabs

PMUI.Tabs:SaveState(data) ​

Saves the currently active tab index into the provided state table.

ПараметрТипОписание
datatableState table to populate.

PMUI.Tabs:LoadState(data) ​

Restores the active tab from a previously saved state. Invalid or out-of-range indices are ignored.

ПараметрТипОписание
datatableState table containing the saved active index.