A persistent slide-out panel docked to the left or right viewport edge, for mobile layouts where desktop side panels don't fit. Add widgets to content; the drawer lives on UIRoot.popupLayer above a tap-to-close scrim while open.

Gestures: swiping in from the docked edge (edgeSwipeEnabled, an invisible strip) pulls the drawer open following the finger; a horizontally-dominant drag on the open drawer slides it back out (vertical drags pass through, so scroll panes inside keep working); releasing settles open/closed by velocity, then position. The scrim tap, Escape and the host's Back handling (via UIRoot.pushOverlayCloser) also close it. open()/close() drive it programmatically. Unlike UIModal, closing does NOT dispose the drawer — reuse it across openings and dispose() it with the screen.

Constructor

new(side:UIDrawerSide, width:Float)

Parameters:

side

the viewport edge to dock to

width

the open drawer's width in UI units

Variables

finalcontent:UIComponent

Put drawer content here (coordinates relative to the drawer's top-left).

@:value(false)edgeSwipeEnabled:Bool = false

Openable by swiping from the viewport edge (default on for mobile).

@:value(false)read onlyisOpen:Bool = false

true once the drawer has settled open (not while animating/dragging).

@:value(0)read onlyprogress:Float = 0

0 = fully closed (off-screen), 1 = fully open.

finalside:UIDrawerSide

The docked edge.

@:value(null)onClosed:() ‑> Void = null

Fired after the drawer finishes closing.

@:value(null)onOpened:() ‑> Void = null

Fired after the drawer finishes opening.

Methods

attachEdge():Void

Installs the edge-swipe strip on the current root. Call once after creating the drawer (and again if the viewport size changes). No-op while edgeSwipeEnabled is false.

close():Void

Slides the drawer closed.

open():Void

Slides the drawer open.

Inherited Variables

Defined by UIComponent

@:value(true)enabled:Bool = true

Disabled widgets ignore the pointer and typically render dimmed.

@:value(0)read onlyh:Float = 0

Layout height in UI units.

@:value(MouseCursor.BUTTON)hoverCursor:MouseCursor = MouseCursor.BUTTON

Native cursor while hovering (interactive widgets; null keeps the arrow).

@:value(false)read onlyhovered:Bool = false

true while the cursor is over this widget.

@:value(false)longPressable:Bool = false

Opts a subclass that overrides onRightPress (without setting onRightClick) into long-press-as-right-click on touch. Widgets with onRightClick set are included automatically.

@:value(null)onClick:() ‑> Void = null

Fired on a completed click (press + release on this widget). Requires an interactive widget.

@:value(null)onHover:() ‑> Void = null

Fired when the cursor first enters this widget (hover-driven descriptions/previews). Interactive widgets only.

@:value(null)onRightClick:() ‑> Void = null

Fired on a right mouse press over this widget (context menus). Only interactive widgets receive pointer events, so this never fires on passive widgets like UILabel/UIPanel — attach it to a UIButton (or another interactive widget) instead. On touch, a long-press fires the same path (see UIRoot.longPressMs).

@:value(false)read onlypressed:Bool = false

true while a press that started here is held.

@:value(null)tooltip:String = null

Optional tooltip text (already-localized or a fixed string).

@:value(null)tooltipShortcut:String = null

Optional right-aligned shortcut hint rendered in the tooltip.

@:value(0)read onlyw:Float = 0

Layout width in UI units (independent of DisplayObject's content-derived width).

Inherited Methods

Defined by UIComponent

invalidate():Void

Schedules a repaint for the next frame (cheap; deduplicated).

resize(width:Float, height:Float):Void

Sets the layout size and repaints when it changed.

Parameters:

width

the new layout width in UI units

height

the new layout height in UI units