Class Drawer
Drawer UI element. A drawer is a UI element that slides in from the side of the screen. It can be used to display additional content or to display a menu.
Implements
Inherited Members
Namespace: Unity.AppUI.UI
Assembly: Unity.AppUI.dll
Syntax
public class Drawer : BaseVisualElement, IEventHandler, IVisualElementScheduler, IExperimentalFeatures, ITransitionAnimations, ITransform, IResolvedStyle, IContextOverrideElement, IAdditionalDataHolder
Constructors
Drawer()
Default constructor.
Declaration
public Drawer()
Fields
backdropUssClassName
The Drawer backdrop styling class.
Declaration
public const string backdropUssClassName = "appui-drawer__backdrop"
Field Value
Type | Description |
---|---|
string |
drawerContainerUssClassName
The Drawer container styling class.
Declaration
public const string drawerContainerUssClassName = "appui-drawer__drawer-container"
Field Value
Type | Description |
---|---|
string |
drawerUssClassName
The Drawer element styling class.
Declaration
public const string drawerUssClassName = "appui-drawer__drawer"
Field Value
Type | Description |
---|---|
string |
elevationUssClassName
The elevation styling class prefix.
Declaration
public const string elevationUssClassName = "appui-elevation-"
Field Value
Type | Description |
---|---|
string |
ussClassName
The Drawer main styling class.
Declaration
public const string ussClassName = "appui-drawer"
Field Value
Type | Description |
---|---|
string |
variantUssClassName
The Drawer variant styling class.
Declaration
public const string variantUssClassName = "appui-drawer--"
Field Value
Type | Description |
---|---|
string |
Properties
anchor
The anchor of the drawer. The drawer will be anchored to the left or right side of the screen.
Declaration
public DrawerAnchor anchor { get; set; }
Property Value
Type | Description |
---|---|
DrawerAnchor |
backdropFinalOpacity
The opacity of the backdrop when the drawer is open.
Declaration
public float backdropFinalOpacity { get; set; }
Property Value
Type | Description |
---|---|
float |
backdropTransitionEnabled
Enable or disable the transition animation for the backdrop when opening or closing the drawer.
Declaration
public bool backdropTransitionEnabled { get; set; }
Property Value
Type | Description |
---|---|
bool |
contentContainer
The content container of the drawer.
Declaration
public override VisualElement contentContainer { get; }
Property Value
Type | Description |
---|---|
VisualElement |
Overrides
distance
The normalized distance of the drawer from the edge of the screen. 0 means the drawer is closed, 1 means the drawer is fully open.
Declaration
public float distance { get; }
Property Value
Type | Description |
---|---|
float |
elevation
The elevation level of the drawer.
Declaration
public float elevation { get; set; }
Property Value
Type | Description |
---|---|
float |
hideBackdrop
Show or hide the backdrop of this drawer.
Declaration
public bool hideBackdrop { get; set; }
Property Value
Type | Description |
---|---|
bool |
hysteresis
The distance threshold to interact with the drawer when swiping.
Declaration
public float hysteresis { get; set; }
Property Value
Type | Description |
---|---|
float |
isOpen
Check if the drawer is open.
Declaration
public bool isOpen { get; set; }
Property Value
Type | Description |
---|---|
bool |
swipeAreaWidth
The size of the swipe area to open the drawer.
Declaration
public float swipeAreaWidth { get; set; }
Property Value
Type | Description |
---|---|
float |
swipeable
Ability to swipe the drawer to open it or close it.
Declaration
public bool swipeable { get; set; }
Property Value
Type | Description |
---|---|
bool |
transitionDurationMs
The duration of the transition when opening or closing the drawer in milliseconds.
Declaration
public int transitionDurationMs { get; set; }
Property Value
Type | Description |
---|---|
int |
variant
The variant of the drawer. Permanent drawers are always open and cannot be closed. Temporary drawers can be opened and closed.
Declaration
public DrawerVariant variant { get; set; }
Property Value
Type | Description |
---|---|
DrawerVariant |
Methods
Close()
Close the drawer.
Declaration
public void Close()
GetAnchorUssClassName(DrawerAnchor)
Declaration
public static string GetAnchorUssClassName(DrawerAnchor enumValue)
Parameters
Type | Name | Description |
---|---|---|
DrawerAnchor | enumValue |
Returns
Type | Description |
---|---|
string |
GetVariantUssClassName(DrawerVariant)
Declaration
public static string GetVariantUssClassName(DrawerVariant enumValue)
Parameters
Type | Name | Description |
---|---|---|
DrawerVariant | enumValue |
Returns
Type | Description |
---|---|
string |
Open()
Open the drawer.
Declaration
public void Open()
Toggle()
Toggle the drawer. If it is open, close it. If it is closed, open it.
Declaration
public void Toggle()
Events
closed
Event fired when the drawer is closed.
Declaration
public event Action<Drawer> closed
Event Type
Type | Description |
---|---|
Action<Drawer> |
opened
Event fired when the drawer is opened.
Declaration
public event Action<Drawer> opened
Event Type
Type | Description |
---|---|
Action<Drawer> |