Class AppBar
AppBar is a component that can be used to display a title, a back button, a drawer button and a set of actions.
Inheritance
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class AppBar : ExVisualElement, IEventHandler, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder
  Constructors
AppBar()
Creates a new AppBar.
Declaration
public AppBar()
  Fields
actionContainerUssClassName
USS class name of the AppBar's action container.
Declaration
public const string actionContainerUssClassName = "appui-appbar__action-container"
  Field Value
| Type | Description | 
|---|---|
| string | 
backButtonUssClassName
USS class name of the AppBar's back button.
Declaration
public const string backButtonUssClassName = "appui-appbar__back-button"
  Field Value
| Type | Description | 
|---|---|
| string | 
barUssClassName
USS class name of the AppBar's bar.
Declaration
public const string barUssClassName = "appui-appbar__bar"
  Field Value
| Type | Description | 
|---|---|
| string | 
bottomBorderUssClassName
USS class name of the AppBar's bottom border element.
Declaration
public const string bottomBorderUssClassName = "appui-appbar__bottom-border"
  Field Value
| Type | Description | 
|---|---|
| string | 
bottomUssClassName
USS class name of the AppBar's bottom element.
Declaration
public const string bottomUssClassName = "appui-appbar__bottom"
  Field Value
| Type | Description | 
|---|---|
| string | 
compactTitleUssClassName
USS class name of the AppBar's compact title.
Declaration
public const string compactTitleUssClassName = "appui-appbar__compact-title"
  Field Value
| Type | Description | 
|---|---|
| string | 
compactUssClassName
USS class name of the AppBar's compact variant.
Declaration
public const string compactUssClassName = "appui-appbar--compact"
  Field Value
| Type | Description | 
|---|---|
| string | 
drawerButtonUssClassName
USS class name of the AppBar's drawer button.
Declaration
public const string drawerButtonUssClassName = "appui-appbar__drawer-button"
  Field Value
| Type | Description | 
|---|---|
| string | 
elevationUssClassName
USS class name of the AppBar's elevation.
Declaration
public const string elevationUssClassName = "appui-elevation-"
  Field Value
| Type | Description | 
|---|---|
| string | 
flexibleSpaceUssClassName
USS class name of the AppBar's flexible space.
Declaration
public const string flexibleSpaceUssClassName = "appui-appbar__flexible-space"
  Field Value
| Type | Description | 
|---|---|
| string | 
largeTitleUssClassName
USS class name of the AppBar's large title.
Declaration
public const string largeTitleUssClassName = "appui-appbar__large-title"
  Field Value
| Type | Description | 
|---|---|
| string | 
spacerUssClassName
USS class name of the AppBar's bar spacer.
Declaration
public const string spacerUssClassName = "appui-appbar__spacer"
  Field Value
| Type | Description | 
|---|---|
| string | 
stretchUssClassName
USS class name of the AppBar's stretch variant.
Declaration
public const string stretchUssClassName = "appui-appbar--stretch"
  Field Value
| Type | Description | 
|---|---|
| string | 
ussClassName
Main USS class name of the AppBar.
Declaration
public const string ussClassName = "appui-appbar"
  Field Value
| Type | Description | 
|---|---|
| string | 
Properties
bottom
Container element for the AppBar's bottom element. This element is located below the flexible space.
Declaration
public VisualElement bottom { get; }
  Property Value
| Type | Description | 
|---|---|
| VisualElement | 
compact
The compactness of the AppBar. Set to true to make it compact. Set to false to use the default size.
Declaration
public bool compact { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
contentContainer
The content container of this element.
Declaration
public override VisualElement contentContainer { get; }
  Property Value
| Type | Description | 
|---|---|
| VisualElement | 
Overrides
elevation
The elevation of the AppBar.
Declaration
public int elevation { get; set; }
  Property Value
| Type | Description | 
|---|---|
| int | 
expandedHeight
The height of the AppBar when it is expanded. See stretch.
Declaration
public float expandedHeight { get; set; }
  Property Value
| Type | Description | 
|---|---|
| float | 
flexibleSpace
The flexible space element.
Declaration
public VisualElement flexibleSpace { get; }
  Property Value
| Type | Description | 
|---|---|
| VisualElement | 
scrollOffset
Set this value based on the scrollview's scrollOffset in order to stretch the AppBar accordingly.
Declaration
public float scrollOffset { get; set; }
  Property Value
| Type | Description | 
|---|---|
| float | 
showBackButton
Display or hide the AppBar's back button.
Declaration
public bool showBackButton { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
showDrawerButton
Display or hide the AppBar's drawer button.
Declaration
public bool showDrawerButton { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
stretch
The stretch of the AppBar. Set to true to make it stretchable. Set to false to make it fixed.
Declaration
public bool stretch { get; set; }
  Property Value
| Type | Description | 
|---|---|
| bool | 
title
The AppBar's title.
Declaration
public string title { get; set; }
  Property Value
| Type | Description | 
|---|---|
| string | 
Methods
AddAction(VisualElement)
Add a new action to the AppBar.
Declaration
public void AddAction(VisualElement actionVisualElement)
  Parameters
| Type | Name | Description | 
|---|---|---|
| VisualElement | actionVisualElement | The action to add.  | 
      
Events
backButtonTriggered
Event triggered when the AppBar's back button is pressed.
Declaration
public event Action backButtonTriggered
  Event Type
| Type | Description | 
|---|---|
| Action | 
drawerButtonTriggered
Event triggered when the AppBar's drawer button is pressed.
Declaration
public event Action drawerButtonTriggered
  Event Type
| Type | Description | 
|---|---|
| Action | 
stretchTriggered
Event triggered when the AppBar is being stretched. The float parameter is the stretch ratio (0.0 to 1.0).
Declaration
public event Action<float> stretchTriggered
  Event Type
| Type | Description | 
|---|---|
| Action<float> |