Class Tabs
A navigation component that allows users to switch between different views or sections.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
[UxmlElement]
public class Tabs : BaseVisualElement, IEventHandler, IResolvedStyle, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IContextOverrideElement, IAdditionalDataHolder, INotifyValueChanged<int>
Remarks
Tabs make it easy to explore and switch between different views or functional aspects of an app. They enable content organization at a high level, such as switching between views, data sets, or functional aspects of an app.
Tabs organize content across different screens, data sets, and other interactions. They consist of a list of tab items that can contain text labels and/or icons. When a tab is selected, it displays an indicator to show which tab is active.
Note: Tabs should be used at the top level of navigation, not for subordinate or lower-level views.
The component supports both horizontal and vertical orientations, different sizes, and can be configured with various styling options like emphasized or justified layouts.
Constructors
Tabs()
Default constructor.
Declaration
public Tabs()
Fields
animatedIndicatorUssClassName
The Tabs animated indicator styling class.
Declaration
public const string animatedIndicatorUssClassName = "appui-tabs__indicator--animated"
Field Value
| Type | Description |
|---|---|
| string |
containerUssClassName
The Tabs container styling class.
Declaration
public const string containerUssClassName = "appui-tabs__container"
Field Value
| Type | Description |
|---|---|
| string |
emphasizedUssClassName
The Tabs emphasized mode styling class.
Declaration
public const string emphasizedUssClassName = "appui-tabs--emphasized"
Field Value
| Type | Description |
|---|---|
| string |
indicatorUssClassName
The Tabs indicator styling class.
Declaration
public const string indicatorUssClassName = "appui-tabs__indicator"
Field Value
| Type | Description |
|---|---|
| string |
justifiedUssClassName
The Tabs justified mode styling class.
Declaration
public const string justifiedUssClassName = "appui-tabs--justified"
Field Value
| Type | Description |
|---|---|
| string |
orientationUssClassName
The Tabs direction styling class.
Declaration
public const string orientationUssClassName = "appui-tabs--"
Field Value
| Type | Description |
|---|---|
| string |
scrollViewUssClassName
The Tabs ScrollView styling class.
Declaration
public const string scrollViewUssClassName = "appui-tabs__scroll-view"
Field Value
| Type | Description |
|---|---|
| string |
sizeUssClassName
The Tabs size styling class.
Declaration
public const string sizeUssClassName = "appui-tabs--size-"
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The Tabs main styling class.
Declaration
public const string ussClassName = "appui-tabs"
Field Value
| Type | Description |
|---|---|
| string |
Properties
bindItem
Method to bind the TabItem.
Declaration
[CreateProperty]
public Action<TabItem, int> bindItem { get; set; }
Property Value
| Type | Description |
|---|---|
| Action<TabItem, int> |
contentContainer
The virtual content container of the Tabs.
Declaration
public override VisualElement contentContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
Overrides
direction
The direction of the Tabs. Horizontal or Vertical.
Declaration
[CreateProperty]
[UxmlAttribute]
public Direction direction { get; set; }
Property Value
| Type | Description |
|---|---|
| Direction |
emphasized
The emphasized mode of the Tabs.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool emphasized { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
itemContainer
The item container of the Tabs.
Declaration
public VisualElement itemContainer { get; }
Property Value
| Type | Description |
|---|---|
| VisualElement |
items
The current list of items used to populate the Tabs.
Declaration
[CreateProperty(ReadOnly = true)]
public IList items { get; }
Property Value
| Type | Description |
|---|---|
| IList |
justified
The justified mode of the Tabs.
Declaration
[CreateProperty]
[UxmlAttribute]
public bool justified { get; set; }
Property Value
| Type | Description |
|---|---|
| bool |
size
The size of the Tabs.
Declaration
[CreateProperty]
[UxmlAttribute]
public Size size { get; set; }
Property Value
| Type | Description |
|---|---|
| Size |
sourceItems
Collection of items used to populate the Tabs.
Declaration
[CreateProperty]
public IList sourceItems { get; set; }
Property Value
| Type | Description |
|---|---|
| IList |
unbindItem
Method to unbind the TabItem.
Declaration
[CreateProperty]
public Action<TabItem, int> unbindItem { get; set; }
Property Value
| Type | Description |
|---|---|
| Action<TabItem, int> |
value
The value of the Tabs. This is the index of the selected TabItem.
Declaration
[CreateProperty]
[UxmlAttribute]
public int value { get; set; }
Property Value
| Type | Description |
|---|---|
| int |
Methods
GetOrientationUssClassName(Direction)
Declaration
public static string GetOrientationUssClassName(Direction enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Direction | enumValue |
Returns
| Type | Description |
|---|---|
| string |
GetSizeUssClassName(Size)
Declaration
public static string GetSizeUssClassName(Size enumValue)
Parameters
| Type | Name | Description |
|---|---|---|
| Size | enumValue |
Returns
| Type | Description |
|---|---|
| string |
GoToNext()
Go to the next TabItem.
Declaration
public bool GoToNext()
Returns
| Type | Description |
|---|---|
| bool | True if the next TabItem is selected, false otherwise. |
GoToPrevious()
Go to the previous TabItem.
Declaration
public bool GoToPrevious()
Returns
| Type | Description |
|---|---|
| bool | True if the previous TabItem is selected, false otherwise. |
SetValueWithoutNotify(int)
Set the value of the Tabs without notifying the change.
Declaration
public void SetValueWithoutNotify(int newValue)
Parameters
| Type | Name | Description |
|---|---|---|
| int | newValue | The new value. |
Exceptions
| Type | Condition |
|---|---|
| ValueOutOfRangeException | Throws if the value is out of range. |