Documentation

UILabel

class UILabel

extends UIControl

Represents a UI component that contains a piece of text.

See Also

UICloseLabel, UIExpandedLabel, UIParagraph, UIHeading1, UIHeading2, UIHeading3, tl.

Example (preset)

UILabel.withText(tt("Hello, world!"))

Constructor

(text?: string): UILabel

.withText() static

(text: string | Binding | { toString(): string; }, style?: string | UIStyle | TextStyle): typeof UILabel

Creates a preset label class with given text (localized using tt if available) and style override, if any.

.withIcon() static

(icon: string | Binding, size?: string | number, color?: string): typeof UILabel

Creates a preset label class with given icon only.

.style

UIStyle

Combined style set; when this is set to an instance of UIStyle, the individual style object properties (e.g. UIComponent.dimensions) are set to read-only objects taken from the UIStyle instance. To override individual properties, set these properties after setting style, or use Component.with to create a new constructor.

.shrinkwrap

boolean

Set to true to shrink this element to use as little space as possible within its container, set to false to expand; defaults to true but may be overridden by individual components (also overrides grow property of UIComponent.dimensions).

.isFocusable()

(): boolean

Returns true if this component can be focused directly using mouse or touch, or manually using UIComponent.requestFocus. This method may be overridden by derived component classes, but the value returned must always be the same.

.isKeyboardFocusable()

(): boolean

Returns true if this component can be focused using the keyboard or other methods; a true return value implies the same for UIComponent.isFocusable. This method may be overridden by derived component classes, but the value returned must always be the same.

.allowFocus

boolean

True if this label may receive direct input focus using the mouse, touch, or using UIComponent.requestFocus (cannot be changed after rendering this component), defaults to false.

.allowKeyboardFocus

boolean

True if this label may receive input focus using the keyboard and all other methods (cannot be changed after rendering this component), defaults to false.

.headingLevel

1 | 2 | 3 | 4 | 5 | 6

Heading level (1 = largest).

.htmlFormat

boolean

True if text should be rendered as HTML instead of plain text.

.text

Stringable

Label text.

.icon

string

Icon name (platform and build system dependent).

.iconSize

string | number

Icon size (in dp or string with unit).

.iconMargin

string | number

Margin between icon and label text (in dp or string with unit).

.iconColor

string

Icon color.

.iconAfter

boolean

Set to true to make the icon appear after the text instead of before.

.applyStyle() protected

(style: UIStyle): void

Inherited from UIControl.applyStyle.

.applyControlStyle() protected

(controlStyle: Partial<ControlStyle>): void

Inherited from UIControl.applyControlStyle.

.applyTextStyle() protected

(textStyle: Partial<TextStyle>): void

Inherited from UIControl.applyTextStyle.

.textStyle

TextStyle

Inherited from UIControl.textStyle.

.controlStyle

ControlStyle

Inherited from UIControl.controlStyle.

.disabled

boolean

Inherited from UIControl.disabled.

.propagateComponentEvent()

(name: string, inner?: ManagedEvent, event?: any): void

Inherited from UIComponent.propagateComponentEvent.

.render()

(callback: RenderCallback<Output<UIRenderable, any>>): void

Inherited from UIComponent.render.

.requestFocus()

(): void

Inherited from UIComponent.requestFocus.

.requestFocusNext()

(): void

Inherited from UIComponent.requestFocusNext.

.requestFocusPrevious()

(): void

Inherited from UIComponent.requestFocusPrevious.

.hidden

boolean

Inherited from UIComponent.hidden.

.dimensions

Dimensions

Inherited from UIComponent.dimensions.

.position

Position

Inherited from UIComponent.position.

.accessibleRole

string

Inherited from UIComponent.accessibleRole.

.accessibleLabel

string

Inherited from UIComponent.accessibleLabel.

.revealTransition

UITransitionType

Inherited from UIComponent.revealTransition.

.exitTransition

UITransitionType

Inherited from UIComponent.exitTransition.

.lastRenderOutput

Output<this, any>

Inherited from UIComponent.lastRenderOutput.

.isPresetComponent() protected

(): boolean

Inherited from Component.isPresetComponent.

.getParentComponent()

[1]. (): Component
[2]. <TParent extends Component>(ParentClass: ComponentConstructor<TParent>): TParent

Inherited from Component.getParentComponent.

.getCompositeParent()

<TParent extends Component>(ParentClass?: ComponentConstructor<TParent>): TParent

Inherited from Component.getCompositeParent.

.managedId

number

Inherited from ManagedObject.managedId.

.managedState

ManagedState

Inherited from ManagedObject.managedState.

.getReferenceCount() protected

(): number

Inherited from ManagedObject.getReferenceCount.

.getManagedReferrers() protected

(): ManagedObject[]

Inherited from ManagedObject.getManagedReferrers.

.getManagedParent() protected

[1]. (): ManagedObject
[2]. <TParent extends ManagedObject>(ParentClass: ManagedObjectConstructor<TParent>): TParent

Inherited from ManagedObject.getManagedParent.

.emit()

<TEvent extends ManagedEvent = ManagedEvent, TConstructorArgs extends any[] = any[]>(e: string | TEvent | (new (...args: TConstructorArgs) => TEvent), ...constructorArgs: TConstructorArgs): this

Inherited from ManagedObject.emit.

.propagateChildEvents() protected

[1]. (f?: (this: this, e: ManagedEvent, propertyName: string) => void | ManagedEvent | ManagedEvent[]): this
[2]. (...types: (ManagedEvent | (new (...args: any[]) => ManagedEvent))[]): this

Inherited from ManagedObject.propagateChildEvents.

.activateManagedAsync() protected

(): Promise<any>

Inherited from ManagedObject.activateManagedAsync.

.deactivateManagedAsync() protected

(): Promise<void>

Inherited from ManagedObject.deactivateManagedAsync.

.destroyManagedAsync() protected

(): Promise<void>

Inherited from ManagedObject.destroyManagedAsync.

.onManagedStateActivatingAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateActivatingAsync.

.onManagedStateActiveAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateActiveAsync.

.onManagedStateDeactivatingAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateDeactivatingAsync.

.onManagedStateInactiveAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateInactiveAsync.

.onManagedStateDestroyingAsync() protected

(): Promise<void>

Inherited from ManagedObject.onManagedStateDestroyingAsync.


UILabel.Presets

extends UIControl.Presets

UILabel presets type, for use with Component.with.

.headingLevel

1 | 2 | 3 | 4 | 5 | 6

Heading level (1-6, or undefined for no heading).

.htmlFormat

boolean

True if text should be rendered as HTML instead of plain text.

.text

Stringable

Label text.

.icon

string

Icon name (platform and build system dependent).

.iconSize

string | number

Icon size (in dp or string with unit).

.iconMargin

string | number

Margin between icon and label text (in dp or string with unit).

.iconColor

string

Icon color.

.iconAfter

boolean

Set to true to make the icon appear after the text instead of before.

.allowFocus

boolean

Set to true to allow this label to receive input focus using mouse, touch, or UIComponent.requestFocus.

.allowKeyboardFocus

boolean

Set to true to allow this label to receive input focus using the keyboard as well as other methods; implies allowFocus.

.textStyle

Partial<{}> | Partial<TextStyle>

Inherited from UIControl.Presets.textStyle.

.controlStyle

Partial<{}> | Partial<ControlStyle>

Inherited from UIControl.Presets.controlStyle.

.disabled

boolean

Inherited from UIControl.Presets.disabled.

.shrinkwrap

boolean

Inherited from UIControl.Presets.shrinkwrap.

.style

string | UIStyle

Inherited from UIComponent.Presets.style.

.hidden

boolean

Inherited from UIComponent.Presets.hidden.

.dimensions

Partial<{}> | Partial<Dimensions>

Inherited from UIComponent.Presets.dimensions.

.position

Partial<{}> | Partial<Position>

Inherited from UIComponent.Presets.position.

.accessibleRole

string

Inherited from UIComponent.Presets.accessibleRole.

.accessibleLabel

string

Inherited from UIComponent.Presets.accessibleLabel.

.requestFocus

boolean

Inherited from UIComponent.Presets.requestFocus.

.revealTransition

UITransitionType

Inherited from UIComponent.Presets.revealTransition.

.exitTransition

UITransitionType

Inherited from UIComponent.Presets.exitTransition.