TabView
Creates a tab view that groups a one or more Tab elements.
Read time 10 minutesLast updated 2 days ago
Definition
- Type: Class
- Namespace: UnityEngine.UIElements
- Assembly: UnityEngine.UIElementsModule
- Inherits from: VisualElement
- Implements: IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle
[Icon("UIToolkit/Icons/TabView.png")][UxmlElement(null, new Type[] { typeof(Tab) }, libraryPath = "Controls")]public class TabView : VisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, ICustomStyle
Remarks
A tab view provides additional functionality to the Tab. It allows a group of tabs to interact between each other by hiding the inactive tabs and displaying the active one. Additionally, it adds the ability to re-order the group of tabs.
For reorderable tabs, it is important to keep the view-data-key unique for the TabView and Tab elements inside of it. The view-data-key helps store the state of the tabs such as the order and state. By having an empty view-data-key, which is the default value, the state of the tabs will not persist when reloading the document.
For more information, refer to UXML element TabView.
Static Fields
Value | Description |
|---|---|
| contentContainerUssClassName | USS class name for the content container of this type. |
| headerContainerClassName | USS class name for the header container of this type. |
| nextButtonUssClassName | USS class name for the scroll next button of this type. |
| previousButtonUssClassName | USS class name for the scroll previous button of this type. |
| reorderableUssClassName | The USS class name for reorderable tab view. |
| ussClassName | USS class name of elements of this type. |
| verticalUssClassName | The USS class name for vertical tab view. |
| viewportUssClassName | USS class name for the content viewport of this type. |
Constructors
Constructor | Description |
|---|---|
| TabView() | Constructs a TabView. |
Properties
Property | Description |
|---|---|
| activeTab | Property that holds the current active tab. |
| contentContainer | The container for the content of the TabView. |
| contentViewport | Represents the visible part of contentContainer. |
| reorderable | A property that adds dragging support to tabs. |
| selectedTabIndex | A property that returns the index of current active tab inside a list of available tabs. |
Methods
Method | Description |
|---|---|
| GetTab | Returns the tab at the specified index. |
| GetTabHeader | Returns the tab header at the specified index. |
| ReorderTab | Moves the tab from the specified index to a new index. |
Events
Member | Description |
|---|---|
| activeTabChanged | Called when the active tab is reassigned. |
| tabClosed | Raised when a tab is closed. The first argument is the tab that was closed, the second is the index of the tab that was closed. |
| tabReordered | Raised when a tab is reordered. The first argument is source index, second is destination index. |