Logo
Layout

Tab Manager

Switch tab content by index or stable ID

Overview

Tab Manager connects tab controls to content panels, with optional titles and a moving indicator.

Preview

Usage

Create the tab setup and populate Tabs.

Give entries stable IDs if scripts should open them by name.

Assign the optional title and indicator objects.


Tips

  • Activation Timing chooses whether the new tab activates at the start or end of its incoming animation.
  • Directional animation can respond to forward/backward navigation.
  • Title and indicator transitions have their own settings.

Public API

Use TabManager in the Evo.UI namespace.

Properties

NameTypeDescription
CurrentTabIndexintActive index.
CurrentTabIDstringActive tab ID, or an empty string.
CurrentTabTabActive Tab entry, or null.

Fields

NameTypeDescription
tabsList<Tab>TabManager.Tab definitions.
inAnimationTweenSequenceEvo Tween incoming sequence.
outAnimationTweenSequenceEvo Tween outgoing sequence.

Methods

NameParametersDescription
OpenTab()int tabIndex, bool animate = trueOpens a tab by index, with optional animation.
OpenTab()string tabID, bool animate = trueOpens a tab by ID, with optional animation.
OpenTab()string tabIDOpens a tab by ID with animation.
OpenTab()int tabIndexOpens a tab by index with animation.
OpenNextTab()NoneOpens the next valid tab.
OpenPreviousTab()NoneOpens the previous valid tab.
OpenFirstTab()NoneOpens the first valid tab.
OpenLastTab()NoneOpens the last valid tab.
AddTab()Tab newTabAdds a Tab entry.
RemoveTab()int indexRemoves a tab by index.
RemoveTab()string tabIDRemoves a tab by ID.
RefreshIndicator()NoneUpdates indicator position and size.
BeginTabsEdit()NoneBegins a batch of edits.
EndTabsEdit()NoneApplies a batch of edits.

Events

NameTypeDescription
onTabChangedUnityEvent<int>Invoked with the active index.

Example

TabManagerExample.cs
using UnityEngine;
using Evo.UI;

public class TabManagerExample : MonoBehaviour
{
    [SerializeField] private TabManager target;

    private void Start()
    {
        // Create a tab with the ID "settings" in the Inspector first.
        target.OpenTab("settings", animate: false);
        target.onTabChanged.AddListener(index => Debug.Log($"Tab {index}"));
    }

    // Bind a button to reopen this tab with its configured transition.
    public void ShowSettings() => target.OpenTab("settings");
}

On this page