docs.unity3d.com
Search Results for

    Show / Hide Table of Contents

    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.

    Inheritance
    object
    CallbackEventHandler
    Focusable
    VisualElement
    BaseVisualElement
    Drawer
    Implements
    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement
    Inherited Members
    BaseVisualElement.contextPrefix
    BaseVisualElement.scaleOverride
    BaseVisualElement.themeOverride
    BaseVisualElement.langOverride
    BaseVisualElement.layoutDirectionOverride
    BaseVisualElement.preferredTooltipPlacementOverride
    BaseVisualElement.tooltipDelayMsOverride
    BaseVisualElement.GetLayoutDirectionUssClassName(Dir)
    VisualElement.disabledUssClassName
    VisualElement.ExecuteDefaultAction(EventBase)
    VisualElement.Focus()
    VisualElement.SendEvent(EventBase)
    VisualElement.SetEnabledFromHierarchy(bool)
    VisualElement.SetEnabled(bool)
    VisualElement.MarkDirtyRepaint()
    VisualElement.ContainsPoint(Vector2)
    VisualElement.Overlaps(Rect)
    VisualElement.DoMeasure(float, VisualElement.MeasureMode, float, VisualElement.MeasureMode)
    VisualElement.ToString()
    VisualElement.GetClasses()
    VisualElement.ClearClassList()
    VisualElement.AddToClassList(string)
    VisualElement.RemoveFromClassList(string)
    VisualElement.ToggleInClassList(string)
    VisualElement.EnableInClassList(string, bool)
    VisualElement.ClassListContains(string)
    VisualElement.FindAncestorUserData()
    VisualElement.Add(VisualElement)
    VisualElement.Insert(int, VisualElement)
    VisualElement.Remove(VisualElement)
    VisualElement.RemoveAt(int)
    VisualElement.Clear()
    VisualElement.ElementAt(int)
    VisualElement.IndexOf(VisualElement)
    VisualElement.Children()
    VisualElement.Sort(Comparison<VisualElement>)
    VisualElement.BringToFront()
    VisualElement.SendToBack()
    VisualElement.PlaceBehind(VisualElement)
    VisualElement.PlaceInFront(VisualElement)
    VisualElement.RemoveFromHierarchy()
    VisualElement.GetFirstOfType<T>()
    VisualElement.GetFirstAncestorOfType<T>()
    VisualElement.Contains(VisualElement)
    VisualElement.FindCommonAncestor(VisualElement)
    VisualElement.viewDataKey
    VisualElement.userData
    VisualElement.canGrabFocus
    VisualElement.focusController
    VisualElement.usageHints
    VisualElement.transform
    VisualElement.layout
    VisualElement.contentRect
    VisualElement.paddingRect
    VisualElement.worldBound
    VisualElement.localBound
    VisualElement.worldTransform
    VisualElement.pickingMode
    VisualElement.name
    VisualElement.enabledInHierarchy
    VisualElement.enabledSelf
    VisualElement.visible
    VisualElement.generateVisualContent
    VisualElement.experimental
    VisualElement.hierarchy
    VisualElement.cacheAsBitmap
    VisualElement.parent
    VisualElement.panel
    VisualElement.visualTreeAssetSource
    VisualElement.this[int]
    VisualElement.childCount
    VisualElement.schedule
    VisualElement.style
    VisualElement.customStyle
    VisualElement.styleSheets
    VisualElement.tooltip
    VisualElement.resolvedStyle
    Focusable.Blur()
    Focusable.focusable
    Focusable.tabIndex
    Focusable.delegatesFocus
    CallbackEventHandler.RegisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.RegisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TUserArgsType, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType>(EventCallback<TEventType>, TrickleDown)
    CallbackEventHandler.UnregisterCallback<TEventType, TUserArgsType>(EventCallback<TEventType, TUserArgsType>, TrickleDown)
    CallbackEventHandler.HandleEvent(EventBase)
    CallbackEventHandler.HasTrickleDownHandlers()
    CallbackEventHandler.HasBubbleUpHandlers()
    CallbackEventHandler.ExecuteDefaultActionAtTarget(EventBase)
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    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 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
    VisualElement.contentContainer

    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>

    Implements

    IEventHandler
    ITransform
    ITransitionAnimations
    IExperimentalFeatures
    IVisualElementScheduler
    IResolvedStyle
    IContextOverrideElement

    Extension Methods

    VisualElementExtensions.FindNavController(VisualElement)
    VisualElementExtensions.GetChildren<T>(VisualElement, bool)
    VisualElementExtensions.GetContextProvider<T>(VisualElement)
    VisualElementExtensions.GetContext<T>(VisualElement)
    VisualElementExtensions.GetPreferredTooltipPlacement(VisualElement)
    VisualElementExtensions.GetSelfContext<T>(VisualElement)
    VisualElementExtensions.GetTooltipTemplate(VisualElement)
    VisualElementExtensions.IsContextProvider<T>(VisualElement)
    VisualElementExtensions.ProvideContext<T>(VisualElement, T)
    VisualElementExtensions.RegisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    VisualElementExtensions.SetPreferredTooltipPlacement(VisualElement, OptionalEnum<PopoverPlacement>)
    VisualElementExtensions.SetTooltipTemplate(VisualElement, VisualElement)
    VisualElementExtensions.UnregisterContextChangedCallback<T>(VisualElement, EventCallback<ContextChangedEvent<T>>)
    In This Article
    Back to top
    Copyright © 2025 Unity Technologies — Trademarks and terms of use
    • Legal
    • Privacy Policy
    • Cookie Policy
    • Do Not Sell or Share My Personal Information
    • Your Privacy Choices (Cookie Settings)