Skip to main content

Component

A base class for UI components that utilizes the LitElement library. Provides functionality for rendering stateless and stateful components, as well as lazy loading of elements using Intersection Observer.

Extends​

  • LitElement

Methods​

create()​

create(template, state)​

static create<T, S>(template, state): [T, UpdateFunction<S>, ComponentUtils<S>]

Creates a new UI component instance based on the provided template and initial state.

Type parameters​
Type parameterDescription
T extends HTMLElementThe type of the UI component element.
S extends Record<string, any>The type of the component state.
Parameters​
ParameterTypeDescription
templateStatefullComponent<S>The stateful component template function.
stateSThe initial state of the component.
Returns​

[T, UpdateFunction<S>, ComponentUtils<S>]

An array containing the created UI component element and a function to update its state.

create(template)​

static create<T>(template): T

Creates a new UI component instance based on the provided template and initial state.

Type parameters​
Type parameterDescription
T extends HTMLElementThe type of the UI component element.
Parameters​
ParameterTypeDescription
templateStatelessComponentThe stateless component template function.
Returns​

T

The created UI component element.