TabView is a VisualElement that renders an interactive button-driven tab strip with optional gamepad InputPrompts for prev/next navigation. Built as an alternative to Unity's built-in TabView, whose tab labels are non-interactable.

Tab View Horizontal Tab View Vertical Tab View in Settings

Why a custom TabView?

Unity's built-in TabView uses non-interactable VisualElements for the tab labels, so they can't be focused or clicked predictably. Luna's variant uses real buttons and adds gamepad prev/next InputPrompts that auto-hide on keyboard/mouse.

Setup

UXML — a TabView plus child Tab elements:

html
<luna:TabView Horizontal="true" ButtonColor="slate" ButtonColorSelected="primary" ActiveTab="0"> <unity:Tab label="Home">...</unity:Tab> <unity:Tab label="Settings">...</unity:Tab> <unity:Tab label="Credits">...</unity:Tab> </luna:TabView>

For a fully customisable tab button (icons, layouts), use the Custom Tab variant — it accepts a VisualTreeAsset for the tab-button content.

Tab View Layout Tab View Usage 1 Tab View Usage 2 Tab View Usage 3 Tab View Usage 4

Inspector (UxmlAttributes)

AttributeTypeDescription
HorizontalboolHorizontal layout if true, vertical otherwise.
ButtonColorstringColor class applied to inactive tab buttons (e.g. "slate").
ButtonColorSelectedstringColor class applied to the active tab button.
ActiveTabintIndex of the active tab (drives OnTabSelected when changed).
ShowInputPromptsboolShow the prev/next gamepad prompts (default true).
InputActionPrevstringInput action for "previous tab" (default "UI/Previous").
InputActionNextstringInput action for "next tab" (default "UI/Next").
HideInputPromptsIfList<InputIconControlScheme>Schemes that should hide the prompts (default: KeyboardMouse).

API

Properties

PropertyTypeDescription
HeaderContainerVisualElementThe full header (prompts + tab buttons).
HeaderTabContainerVisualElementJust the tab-button strip (no prompts).

Events

csharp
public event Action<int> OnTabSelected;

Fires when ActiveTab changes — int parameter is the new index.

CSS classes

ClassTargets
TabViewRoot.
TabView__header-containerHeader (prompts + tabs).
TabView__header-tab-containerTab-button strip.
TabView__header-tabEach tab button.
TabView__header-tab-selectedActive tab button.
TabView__header-tab-input-promptPrev/next InputPrompts.

Custom Tab Component

The built-in Tab button is the easiest path but can't be customised. The Custom Tab variant accepts a VisualTreeAsset and renders any layout (icon + label, badges, etc.) inside the tab button.

Custom Tab Custom Tab 2

See also

Settings

Theme

Light

Contrast

Material

Dark

Dim

Material Dark

System

Sidebar(Light & Contrast only)

Light
Dark

Font Family

DM Sans

Wix

Inclusive Sans

AR One Sans

Direction

LTR
RTL