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, ITransform, ITransitionAnimations, IExperimentalFeatures, IVisualElementScheduler, IResolvedStyle, IContextOverrideElement
Constructors
Drawer()
Default constructor.
Declaration
public Drawer()
Fields
backdropUssClassName
The Drawer backdrop styling class.
Declaration
public static readonly string backdropUssClassName
Field Value
| Type | Description |
|---|---|
| string |
drawerContainerUssClassName
The Drawer container styling class.
Declaration
public static readonly string drawerContainerUssClassName
Field Value
| Type | Description |
|---|---|
| string |
drawerUssClassName
The Drawer element styling class.
Declaration
public static readonly string drawerUssClassName
Field Value
| Type | Description |
|---|---|
| string |
elevationUssClassName
The elevation styling class prefix.
Declaration
public static readonly string elevationUssClassName
Field Value
| Type | Description |
|---|---|
| string |
ussClassName
The Drawer main styling class.
Declaration
public static readonly string ussClassName
Field Value
| Type | Description |
|---|---|
| string |
variantUssClassName
The Drawer variant styling class.
Declaration
public static readonly string variantUssClassName
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()
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> |