Skip to content

Base Class

Element

Element is the base class of all components, and the properties, methods, and events are inherited by all components.

Properties

PropertyDescriptiontypeDefault
idElement’s unique device identifiernumber-
parentParent elementElement-
rootElementRoot elementElement-
windowOwning windowWindow-
styleStyleStyleProps-
hoverStyleHover styleStyleProps-
scrollTopVertical scroll positionnumber0
scrollLeftHorizontal scroll positionnumber0
draggableIs the element cocoa dragbooleanfalse
cursorCursorstringdefault
sizeElement size[number, number]-
contentSizeElement content size[number, number]-
scrollHeightScroll bar heightnumber-
scrollWidthScroll bar widthnumber-
autoFocusWhether to autofocusbooleanfalse

Methods

MethodsDescriptionReture type
focusFocusvoid
getBoundingClientRectGet element rectangleElementRect

Events

EventDescriptionEvent type
boundschangeElement position or size changeIBoundsChangeEvent
focusGains focus-
blurLoses focus-
clickClickIMouseEvent
contextmenuContext menu (right mouse click)IMouseEvent
mousedownMouse button pressedIMouseEvent
mouseupMouse button releasedIMouseEvent
mousemoveCursor movesIMouseEvent
mouseenterCursor enters elementIMouseEvent
mouseleaveCursor leaves elementIMouseEvent
keydownKeyboard key pressed-
keyupKeyboard key released-
sizechangedElement size changed-
scrollScrolling-
mousewhellMouse wheel scrolled-
dragstartDrag operation started-
dragoverDragged over drop target-
dropDrag operation completed-
touchstartTouch interaction started-
touchmoveTouch moved-
touchendTouch interaction ended-
touchcancelTouch interaction canceled-