Label

extendsDisplayObject โ†’ Object

Displays single line or multiline text. Additionaly, text color and style as example bold are possible. Custom typeface also possible if supported font file such as .ttf, .otf, or .woff stored in specified resource directory.

Properties#

nameTypeDefault ValueDescription
backgroundColornumber0xff000000 (transparent)Use app.colors.* to set the color.
textstring""Text that going to be displayed
textSizestring or numberapp.res.style.controlTextSizeCan be either plain number or number with unit.
textColornumberapp.res.style.textColorUse app.colors.* to set the color.
widthstring or number"content"Can be number, number with unit, "content", or "container". see sizing guide.
heightstring or number"content"Can be number, number with unit, "content", or "container". see sizing guide.
boldbooleanfalseSet true to make the text bold.
italicbooleanfalseSet true to make the text italic.
underlinebooleanfalseSet true to make the text underline.
wrapbooleantrueKeep this true to let the excess text move to the new line.
alignTextstring""Align text of this widget. See alignment guide.
fontTypestring""Set this to desired font file name for custom typography or ignore this to use default font.

Inherited from DisplayObject#

nameTypeDefault ValueDescription
idstring(8-digit random)Identifies widget. Set this to make it searchable.
xstring or number0Can be either plain number or number with unit.
ystring or number0Can be either plain number or number with unit.
scaleXnumber1.0Fraction of number. This will multiply width.
scaleYnumber1.0Fraction of number. This will multiply height.
scalenumber1.0Set this to change both scaleX and scaleY at once.
alphanumber1.00.0 means transparent and 1.0 is fully opaque.
anglenumber00.0 means transparent and 1.0 is fully opaque.
elevationstring or number0Can be either plain number or number with unit.
cornerRadiusstring or number0Can be either plain number or number with unit.
presencebooleantrueIf true, this widget will affects other widgets' position and size.
visiblebooleantrueIf true, this widget will be drawn.
clippingbooleantrueIf true, content of this widget will be cropped if exceed the boundary.
suspendUpdatebooleantrueSet true to temporarily prevent update trigger.
foregroundColornumberapp.res.style.foregroundColorUse app.colors.* to set the color.
borderColornumberthis.foregroundColorUse app.colors.* to set the color.
borderSizestring or number0Can be either plain number or number with unit.
paddingTopstring or number0Can be either plain number or number with unit.
paddingBottomstring or number0Can be either plain number or number with unit.
paddingLeftstring or number0Can be either plain number or number with unit.
paddingRightstring or number0Can be either plain number or number with unit.
paddingHorizontalstring or number0Set this to write both paddingLeft and paddingRight at once.
paddingVerticalstring or number0Set this to write both paddingTop and paddingBottom at once.
paddingsstring or number0Set this to write paddingTop, paddingBottom, paddingLeft and paddingRight.
marginTopstring or number0Can be either plain number or number with unit.
marginBottomstring or number0Can be either plain number or number with unit.
marginLeftstring or number0Can be either plain number or number with unit.
marginRightstring or number0Can be either plain number or number with unit.
marginHorizontalstring or number0Set this to write both marginLeft and marginRight at once.
marginVerticalstring or number0Set this to write both marginTop and marginBottom at once.
marginsstring or number0Set this to write marginTop, marginBottom, marginLeft and marginRight.
alignSelfstring""Align position of this widget. See alignment guide.
hookTopToTopOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookTopToBottomOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookBottomToBottomOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookBottomToTopOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookLeftToLeftOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookLeftToRightOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookRightToRightOfstring""ID of targeted widget. Only works if currently content of HookLayout.
hookRightToLeftOfstring""ID of targeted widget. Only works if currently content of HookLayout.
onDrawfunction(empty function)Event listeners that you could set on .fiwl layout.
onUpdatefunction(empty function)Event listeners that you could set on .fiwl layout.
onSelectfunction(empty function)Event listeners that you could set on .fiwl layout.
onOptionfunction(empty function)Event listeners that you could set on .fiwl layout.
onScrollfunction(empty function)Event listeners that you could set on .fiwl layout.
onDragStartfunction(empty function)Event listeners that you could set on .fiwl layout.
onDragMovefunction(empty function)Event listeners that you could set on .fiwl layout.
onDragEndfunction(empty function)Event listeners that you could set on .fiwl layout.
onHoverStartfunction(empty function)Event listeners that you could set on .fiwl layout.
onHoverMovefunction(empty function)Event listeners that you could set on .fiwl layout.
onHoverEndfunction(empty function)Event listeners that you could set on .fiwl layout.
onAsyncCreatefunction(empty function)Event listeners that you could set on .fiwl layout.
onReadyfunction(empty function)Event listeners that you could set on .fiwl layout.
onSuspendfunction(empty function)Event listeners that you could set on .fiwl layout.
onDestroyfunction(empty function)Event listeners that you could set on .fiwl layout.

Read-only Properties#

NameTypeDescription
measuredContentsWidthnumberMeasured width = "contents" value.
measuredContentsHeightnumberMeasured height = "contents" value.

Inherited from DisplayObject#

NameTypeDescription
containerobjectGet this instance's container. See Layout Principle.
globalXnumberGet pre-calculated absolute horizontal position.
globalYnumberGet pre-calculated absolute vertical position.
measuredWidthnumberGet pre-calculated absolute width.
measuredHeightnumberGet pre-calculated absolute height.

Methods#

Inherited from DisplayObject#

NameReturn TypeDescription
requestUpdatevoidManually request to re-render.
addEventListenervoidCalls app.event.addEventListener with this widget as context.
removeEventListenervoidCalls app.event.removeEventListener with this widget as context.