AbstractReadonlyrootReadonlytemplateStaticobservedAttributes to watch for changes for updates.
StaticrootThe mode for this Component's ShadowRoot.
MDN: https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/mode
StaticstyleStyles to encapsulate to this component's root.
StatictagThe HTML tag name to use for this Component
StatictemplateAn HTML Template element for this element to use.
Whether the component is connected and has completed its first render
Accessor for live reactive state.
For the full state manipulation API, use getState
Replace the current state with a new value or adopt a whole different State instance
OptionalafterCalled immediately after each template update
ProtectedattributeUse beforeUpdate and afterUpdate instead
OptionalbeforeCalled immediately before each template update
ProtectedconnectedUse script instead
Protecteddisconnecteduse finalize
Publish a CustomEvent with the provided name and options.
Default options are:
{
bubbles: true,
cancelable: true,
composed: true,
detail: undefined,
}
The name of the custom event to publish
Optionaloptions: CustomEventInit<T>Options to configure the custom event
Dispatch an existing Event from this element, as usual
OptionalfinalizeFinal lifecycle method called at the end of the unmounting process.
Access the full State instance for this Component.
OptionalinitialThe initial state for this Component
Listen for events on a child element based on the provided query
A function which removes the listener when called
Listen for events on a child element based on the provided component's tag
Attributes to watch for changes for updates.
The mode for this Component's ShadowRoot.
MDN: https://developer.mozilla.org/en-US/docs/Web/API/ShadowRoot/mode
Styles to encapsulate to this component's root.
The HTML tag name to use for this Component
An HTML Template element for this element to use.
A function which removes the listener when called
Listen for events on the host element
A function which removes the listener when called
Listen for events on the host element
A function which removes the listener when called
OptionalonHandle errors thrown during lifecycle methods of this component or any unhandled errors from child components.
Returns a reference to the HTML Element with the provided ID within the shadow root of this component.
Throws an error if no element with the provided ID is found
Manually schedule a render to occur.
Calling render multiple times in the same event loop won't schedule multiple renders. Renders are scheduled to occur on the next animation frame.
Read an attribute from the host element, falling back to a default.
With a string default, returns the attribute value or the default when the attribute is missing. With a number default, the attribute is parsed as a number and the default is returned when it's missing or not a number.
Read an attribute from the host element, falling back to a default.
With a string default, returns the attribute value or the default when the attribute is missing. With a number default, the attribute is parsed as a number and the default is returned when it's missing or not a number.
OptionalscriptInitialization lifecycle method. Main scripting and event listeners.
a function to handle cleanup tasks when the component unmounts
OptionaltemplateA function returning an object which populates the data values in the
templating engine. Such values are accessed using the * notation.
Called on every render with the host's current attributes and state.
Serialize this element to a string
StaticisStaticisStaticread
The Component class extends the base HTMLElement class to provide an ergonomic way to design and develop Web Components with reactive state, managed attributes, and dynamic templating.