Documentation

UIComponent

This is the base class of all UI (view) components.

class UIComponent abstract

extends Component implements UIRenderable

Represents a visible part of the user interface.

Note: This class should not be instantiated on its own. Instead, use one of the predefined UI components such as UIButton and UILabel, a shortcut function such as tl, or create your own view component using the ViewComponent class.

Constructor

(): UIComponent

.propagateComponentEvent()

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

Create and emit a UI event with given name and a reference to this component, as well as an optional platform event; see Component.propagateComponentEvent.

.render()

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

Trigger asynchronous rendering for this component, and all contained components (if any). Rendered output is passed to given callback (from the application level UIRenderContext, or from a containing UI component).

.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.

.requestFocus()

(): void

Request input focus on this component.

Note: Not all components can be focused. Components can only be focused after they are rendered, so consider using this method inside of a Rendered event handler.

.requestFocusNext()

(): void

Request input focus for the next sibling component.

.requestFocusPrevious()

(): void

Request input focus for the previous sibling component.

.applyStyle() protected

(style: UIStyle): void

Applies given style set to individual style objects (e.g. UIComponent.dimensions), overridden in derived classes to copy applicable styles.

.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.

.hidden

boolean

Set to true to hide this component from view (while it is still rendered).

.dimensions

Dimensions

Options for the dimensions of this component.

.position

Position

Options for the positioning of this component within parent component(s).

.accessibleRole

string

WAI-ARIA role for this component, if applicable.

.accessibleLabel

string

WAI-ARIA label text for this component (not tooltip), if applicable.

.revealTransition

UITransitionType

Animated transition that plays when this component is first rendered.

.exitTransition

UITransitionType

Animated transition that plays when this component is removed from a container.

.lastRenderOutput

Output<this, any>

Last rendered output, if any; set by the renderer.

.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.


UIComponent.Presets

UIComponent base presets type, for use with Component.with.

.style

string | UIStyle

Style set (either an instance of UIStyle or the name of a style set defined in UITheme.current), which is mixed into the current style set on the component, before setting any other style properties.

.hidden

boolean

Set to true to hide this component from view (while it is still rendered).

.dimensions

Partial<{}> | Partial<Dimensions>

Options for the dimensions of this component (overrides).

.position

Partial<{}> | Partial<Position>

Options for the positioning of this component within parent component(s) (overrides).

.accessibleRole

string

WAI-ARIA role for this component, if applicable.

.accessibleLabel

string

WAI-ARIA label text for this component (not tooltip), if applicable.

.requestFocus

boolean

Set to true to request focus immediately after rendering for the first time; cannot be used together with onRendered.

.revealTransition

UITransitionType

Animation that plays when this component is first rendered.

.exitTransition

UITransitionType

Animation that plays when this component is removed from a container.


UIComponent.DynamicRendererWrapper

Stateful renderer for dynamic content (used by UIRenderableController, ViewComponent, etc.).

Constructor

(): DynamicRendererWrapper

.render()

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

Render given content using given callback, or previously stored callback.

.removeAsync()

(): Promise<unknown>

Remove previously rendered output.