Logo
Navigation

Tab Navigation

A keyboard friendly tab order and focus navigation component

Overview

Tab Navigation provides keyboard style tab movement across UI elements in a defined order. It supports automatic detection of tabbable UI elements, manual custom tab sequences, wrap around behavior, and skipping disabled or excluded elements.

It updates the currently selected UI element, moves to the next or previous selectable using the Tab or Shift+Tab keys, and works alongside Unity's EventSystem.


Usage

Add Tab Navigation to any parent UI object

If Auto Find Tabbables is enabled:

  • All Selectables under the object are scanned
  • Items with TabbableElement override natural order
  • Items with ExcludeFromTabOrder are ignored

If you prefer manual order:

  • Add items to Custom Tab Order
  • Disable Auto Find Tabbables

Enable Select First At Start if you want the UI to auto select the first item on Start

The system listens for Tab and Shift+Tab events automatically


Properties

NameTypeDescription
wrapAroundboolIf true, Tab from the last element jumps to the first (and vice versa with Shift+Tab)
autoFindTabbablesboolIf true, detect Selectables under the object automatically
selectFirstAtStartboolSelect the first tabbable element automatically at Start
customTabOrderList<Selectable>Optional manual list for exact ordering

Public Methods

NameParametersDescription
TabToNext(reverse)boolMoves selection forward or backward
RefreshTabbableElements()NoneRebuilds the tabbable list
AddToCustomTabOrder(selectable)SelectableAdds an element to the custom order
RemoveFromCustomTabOrder(selectable)SelectableRemoves an element from the custom list

Code Example

TabNavigationExample.cs
using UnityEngine;
using Evo.UI;
using UnityEngine.UI;

public class TabNavigationExample : MonoBehaviour
{
    public TabNavigation navigation;

    void Start()
    {
        // Enable wrap around cycling
        navigation.wrapAround = true;

        // Automatically find selectables under this object
        navigation.autoFindTabbables = true;

        // Optionally auto select the first item when UI opens
        navigation.selectFirstAtStart = true;

        // Rebuild the tabbable list
        navigation.RefreshTabbableElements();
    }

    // Example: manually jump to next or previous
    public void Next()
    {
        navigation.TabToNext();
    }

    public void Previous()
    {
        navigation.TabToNext(reverse: true);
    }

    // Example of adding objects to custom order
    public void AssignCustomOrder(Selectable[] items)
    {
        navigation.customTabOrder.Clear();
        foreach (var item in items)
        {
            navigation.AddToCustomTabOrder(item);
        }

        navigation.RefreshTabbableElements();
    }
}

On this page