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
| Name | Type | Description |
|---|---|---|
wrapAround | bool | If true, Tab from the last element jumps to the first (and vice versa with Shift+Tab) |
autoFindTabbables | bool | If true, detect Selectables under the object automatically |
selectFirstAtStart | bool | Select the first tabbable element automatically at Start |
customTabOrder | List<Selectable> | Optional manual list for exact ordering |
Public Methods
| Name | Parameters | Description |
|---|---|---|
TabToNext(reverse) | bool | Moves selection forward or backward |
RefreshTabbableElements() | None | Rebuilds the tabbable list |
AddToCustomTabOrder(selectable) | Selectable | Adds an element to the custom order |
RemoveFromCustomTabOrder(selectable) | Selectable | Removes an element from the custom list |
Code Example
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();
}
}